@@ -875,6 +875,23 @@ These are just used by the other operators for shuffling local execution state a
875
875
andBool Gemptyisnonexistent << SCHED >>
876
876
```
877
877
878
+ - ` #baseFeePerBlobGas ` will compute the blob base fee as specified by EIPs 4844 and 7516
879
+
880
+ ``` k
881
+ syntax Int ::= #baseFeePerBlobGas( Int ) [symbol(#baseFeePerBlobGas), function]
882
+ // -------------------------------------------------------------------------------
883
+ rule #baseFeePerBlobGas(BLOBGAS) => #fakeExponential(1, BLOBGAS, 3338477)
884
+
885
+ syntax Int ::= #fakeExponential(Int, Int, Int) [symbol(#fakeExponential), function]
886
+ | #fakeExponential(Int, Int, Int, Int, Int) [function]
887
+ // -------------------------------------------------------------------
888
+ rule #fakeExponential(FACTOR, NUMER, DENOM) => #fakeExponential(1, 0, FACTOR *Int DENOM, NUMER, DENOM)
889
+
890
+ rule #fakeExponential(I, OUTPUT, ACCUM, NUMER, DENOM)
891
+ => #fakeExponential(I +Int 1, OUTPUT +Int ACCUM, ACCUM *Int NUMER /Int (DENOM *Int I), NUMER, DENOM) requires ACCUM >Int 0
892
+ rule #fakeExponential(_, OUTPUT, _, _, DENOM) => OUTPUT /Int DENOM [owise]
893
+ ```
894
+
878
895
### Invalid Operator
879
896
880
897
We use ` INVALID ` both for marking the designated invalid operator, and ` UNDEFINED(_) ` for garbage bytes in the input program.
@@ -1005,13 +1022,14 @@ NOTE: We have to call the opcode `OR` by `EVMOR` instead, because K has trouble
1005
1022
These operators make queries about the current execution state.
1006
1023
1007
1024
``` k
1008
- syntax NullStackOp ::= "PC" | "GAS" | "GASPRICE" | "GASLIMIT" | "BASEFEE"
1009
- // -------------------------------------------------------------------------
1010
- rule <k> PC => PCOUNT ~> #push ... </k> <pc> PCOUNT </pc>
1011
- rule <k> GAS => gas2Int(GAVAIL) ~> #push ... </k> <gas> GAVAIL </gas>
1012
- rule <k> GASPRICE => GPRICE ~> #push ... </k> <gasPrice> GPRICE </gasPrice>
1013
- rule <k> GASLIMIT => GLIMIT ~> #push ... </k> <gasLimit> GLIMIT </gasLimit>
1014
- rule <k> BASEFEE => BFEE ~> #push ... </k> <baseFee> BFEE </baseFee>
1025
+ syntax NullStackOp ::= "PC" | "GAS" | "GASPRICE" | "GASLIMIT" | "BASEFEE" | "BLOBBASEFEE"
1026
+ // -----------------------------------------------------------------------------------------
1027
+ rule <k> PC => PCOUNT ~> #push ... </k> <pc> PCOUNT </pc>
1028
+ rule <k> GAS => gas2Int(GAVAIL) ~> #push ... </k> <gas> GAVAIL </gas>
1029
+ rule <k> GASPRICE => GPRICE ~> #push ... </k> <gasPrice> GPRICE </gasPrice>
1030
+ rule <k> GASLIMIT => GLIMIT ~> #push ... </k> <gasLimit> GLIMIT </gasLimit>
1031
+ rule <k> BASEFEE => BFEE ~> #push ... </k> <baseFee> BFEE </baseFee>
1032
+ rule <k> BLOBBASEFEE => #baseFeePerBlobGas(BLOBGAS) ~> #push ... </k> <excessBlobGas> BLOBGAS </excessBlobGas>
1015
1033
1016
1034
syntax NullStackOp ::= "COINBASE" | "TIMESTAMP" | "NUMBER" | "DIFFICULTY" | "PREVRANDAO"
1017
1035
// ----------------------------------------------------------------------------------------
@@ -2259,6 +2277,7 @@ The intrinsic gas calculation mirrors the style of the YellowPaper (appendix H).
2259
2277
rule <k> #gasExec(SCHED, PREVRANDAO) => Gbase < SCHED > ... </k>
2260
2278
rule <k> #gasExec(SCHED, GASLIMIT) => Gbase < SCHED > ... </k>
2261
2279
rule <k> #gasExec(SCHED, BASEFEE) => Gbase < SCHED > ... </k>
2280
+ rule <k> #gasExec(SCHED, BLOBBASEFEE) => Gbase < SCHED > ... </k>
2262
2281
rule <k> #gasExec(SCHED, POP _) => Gbase < SCHED > ... </k>
2263
2282
rule <k> #gasExec(SCHED, PC) => Gbase < SCHED > ... </k>
2264
2283
rule <k> #gasExec(SCHED, PUSHZERO) => Gbase < SCHED > ... </k>
@@ -2454,6 +2473,7 @@ After interpreting the strings representing programs as a `WordStack`, it should
2454
2473
rule #dasmOpCode( 70, SCHED ) => CHAINID requires Ghaschainid << SCHED >>
2455
2474
rule #dasmOpCode( 71, SCHED ) => SELFBALANCE requires Ghasselfbalance << SCHED >>
2456
2475
rule #dasmOpCode( 72, SCHED ) => BASEFEE requires Ghasbasefee << SCHED >>
2476
+ rule #dasmOpCode( 74, SCHED ) => BLOBBASEFEE requires Ghasblobbasefee << SCHED >>
2457
2477
rule #dasmOpCode( 80, _ ) => POP
2458
2478
rule #dasmOpCode( 81, _ ) => MLOAD
2459
2479
rule #dasmOpCode( 82, _ ) => MSTORE
0 commit comments