@@ -875,6 +875,26 @@ 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(MIN_BASE_FEE_PER_BLOB_GAS, BLOBGAS, BLOB_BASE_FEE_UPDATE_FRACTION)
884
+ syntax Int ::= "MIN_BASE_FEE_PER_BLOB_GAS" [macro] | "BLOB_BASE_FEE_UPDATE_FRACTION" [macro]
885
+ rule MIN_BASE_FEE_PER_BLOB_GAS => 1
886
+ rule BLOB_BASE_FEE_UPDATE_FRACTION => 3338477
887
+
888
+ syntax Int ::= #fakeExponential(Int, Int, Int) [symbol(#fakeExponential), function]
889
+ | #fakeExponential(Int, Int, Int, Int, Int) [function]
890
+ // -------------------------------------------------------------------
891
+ rule #fakeExponential(FACTOR, NUMER, DENOM) => #fakeExponential(1, 0, FACTOR *Int DENOM, NUMER, DENOM)
892
+
893
+ rule #fakeExponential(I, OUTPUT, ACCUM, NUMER, DENOM)
894
+ => #fakeExponential(I +Int 1, OUTPUT +Int ACCUM, ACCUM *Int NUMER /Int (DENOM *Int I), NUMER, DENOM) requires ACCUM >Int 0
895
+ rule #fakeExponential(_, OUTPUT, _, _, DENOM) => OUTPUT /Int DENOM [owise]
896
+ ```
897
+
878
898
### Invalid Operator
879
899
880
900
We use ` INVALID ` both for marking the designated invalid operator, and ` UNDEFINED(_) ` for garbage bytes in the input program.
@@ -1005,13 +1025,14 @@ NOTE: We have to call the opcode `OR` by `EVMOR` instead, because K has trouble
1005
1025
These operators make queries about the current execution state.
1006
1026
1007
1027
``` 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>
1028
+ syntax NullStackOp ::= "PC" | "GAS" | "GASPRICE" | "GASLIMIT" | "BASEFEE" | "BLOBBASEFEE"
1029
+ // -----------------------------------------------------------------------------------------
1030
+ rule <k> PC => PCOUNT ~> #push ... </k> <pc> PCOUNT </pc>
1031
+ rule <k> GAS => gas2Int(GAVAIL) ~> #push ... </k> <gas> GAVAIL </gas>
1032
+ rule <k> GASPRICE => GPRICE ~> #push ... </k> <gasPrice> GPRICE </gasPrice>
1033
+ rule <k> GASLIMIT => GLIMIT ~> #push ... </k> <gasLimit> GLIMIT </gasLimit>
1034
+ rule <k> BASEFEE => BFEE ~> #push ... </k> <baseFee> BFEE </baseFee>
1035
+ rule <k> BLOBBASEFEE => #baseFeePerBlobGas(BLOBGAS) ~> #push ... </k> <excessBlobGas> BLOBGAS </excessBlobGas>
1015
1036
1016
1037
syntax NullStackOp ::= "COINBASE" | "TIMESTAMP" | "NUMBER" | "DIFFICULTY" | "PREVRANDAO"
1017
1038
// ----------------------------------------------------------------------------------------
@@ -2259,6 +2280,7 @@ The intrinsic gas calculation mirrors the style of the YellowPaper (appendix H).
2259
2280
rule <k> #gasExec(SCHED, PREVRANDAO) => Gbase < SCHED > ... </k>
2260
2281
rule <k> #gasExec(SCHED, GASLIMIT) => Gbase < SCHED > ... </k>
2261
2282
rule <k> #gasExec(SCHED, BASEFEE) => Gbase < SCHED > ... </k>
2283
+ rule <k> #gasExec(SCHED, BLOBBASEFEE) => Gbase < SCHED > ... </k>
2262
2284
rule <k> #gasExec(SCHED, POP _) => Gbase < SCHED > ... </k>
2263
2285
rule <k> #gasExec(SCHED, PC) => Gbase < SCHED > ... </k>
2264
2286
rule <k> #gasExec(SCHED, PUSHZERO) => Gbase < SCHED > ... </k>
@@ -2454,6 +2476,7 @@ After interpreting the strings representing programs as a `WordStack`, it should
2454
2476
rule #dasmOpCode( 70, SCHED ) => CHAINID requires Ghaschainid << SCHED >>
2455
2477
rule #dasmOpCode( 71, SCHED ) => SELFBALANCE requires Ghasselfbalance << SCHED >>
2456
2478
rule #dasmOpCode( 72, SCHED ) => BASEFEE requires Ghasbasefee << SCHED >>
2479
+ rule #dasmOpCode( 74, SCHED ) => BLOBBASEFEE requires Ghasblobbasefee << SCHED >>
2457
2480
rule #dasmOpCode( 80, _ ) => POP
2458
2481
rule #dasmOpCode( 81, _ ) => MLOAD
2459
2482
rule #dasmOpCode( 82, _ ) => MSTORE
0 commit comments