@@ -26,58 +26,58 @@ import (
2626)
2727
2828var (
29- minDataGasPrice = big .NewInt (params .BlobTxMinDataGasprice )
30- dataGaspriceUpdateFraction = big .NewInt (params .BlobTxDataGaspriceUpdateFraction )
29+ minBlobGasPrice = big .NewInt (params .BlobTxMinBlobGasprice )
30+ blobGaspriceUpdateFraction = big .NewInt (params .BlobTxBlobGaspriceUpdateFraction )
3131)
3232
33- // VerifyEIP4844Header verifies the presence of the excessDataGas field and that
34- // if the current block contains no transactions, the excessDataGas is updated
33+ // VerifyEIP4844Header verifies the presence of the excessBlobGas field and that
34+ // if the current block contains no transactions, the excessBlobGas is updated
3535// accordingly.
3636func VerifyEIP4844Header (parent , header * types.Header ) error {
3737 // Verify the header is not malformed
38- if header .ExcessDataGas == nil {
39- return errors .New ("header is missing excessDataGas " )
38+ if header .ExcessBlobGas == nil {
39+ return errors .New ("header is missing excessBlobGas " )
4040 }
41- if header .DataGasUsed == nil {
42- return errors .New ("header is missing dataGasUsed " )
41+ if header .BlobGasUsed == nil {
42+ return errors .New ("header is missing blobGasUsed " )
4343 }
4444 // Verify that the data gas used remains within reasonable limits.
45- if * header .DataGasUsed > params .BlobTxMaxDataGasPerBlock {
46- return fmt .Errorf ("data gas used %d exceeds maximum allowance %d" , * header .DataGasUsed , params .BlobTxMaxDataGasPerBlock )
45+ if * header .BlobGasUsed > params .BlobTxMaxBlobGasPerBlock {
46+ return fmt .Errorf ("data gas used %d exceeds maximum allowance %d" , * header .BlobGasUsed , params .BlobTxMaxBlobGasPerBlock )
4747 }
48- if * header .DataGasUsed % params .BlobTxDataGasPerBlob != 0 {
49- return fmt .Errorf ("data gas used %d not a multiple of data gas per blob %d" , header .DataGasUsed , params .BlobTxDataGasPerBlob )
48+ if * header .BlobGasUsed % params .BlobTxBlobGasPerBlob != 0 {
49+ return fmt .Errorf ("data gas used %d not a multiple of data gas per blob %d" , header .BlobGasUsed , params .BlobTxBlobGasPerBlob )
5050 }
51- // Verify the excessDataGas is correct based on the parent header
51+ // Verify the excessBlobGas is correct based on the parent header
5252 var (
53- parentExcessDataGas uint64
54- parentDataGasUsed uint64
53+ parentExcessBlobGas uint64
54+ parentBlobGasUsed uint64
5555 )
56- if parent .ExcessDataGas != nil {
57- parentExcessDataGas = * parent .ExcessDataGas
58- parentDataGasUsed = * parent .DataGasUsed
56+ if parent .ExcessBlobGas != nil {
57+ parentExcessBlobGas = * parent .ExcessBlobGas
58+ parentBlobGasUsed = * parent .BlobGasUsed
5959 }
60- expectedExcessDataGas := CalcExcessDataGas ( parentExcessDataGas , parentDataGasUsed )
61- if * header .ExcessDataGas != expectedExcessDataGas {
62- return fmt .Errorf ("invalid excessDataGas : have %d, want %d, parent excessDataGas %d, parent blobDataUsed %d" ,
63- * header .ExcessDataGas , expectedExcessDataGas , parentExcessDataGas , parentDataGasUsed )
60+ expectedExcessBlobGas := CalcExcessBlobGas ( parentExcessBlobGas , parentBlobGasUsed )
61+ if * header .ExcessBlobGas != expectedExcessBlobGas {
62+ return fmt .Errorf ("invalid excessBlobGas : have %d, want %d, parent excessBlobGas %d, parent blobDataUsed %d" ,
63+ * header .ExcessBlobGas , expectedExcessBlobGas , parentExcessBlobGas , parentBlobGasUsed )
6464 }
6565 return nil
6666}
6767
68- // CalcExcessDataGas calculates the excess data gas after applying the set of
68+ // CalcExcessBlobGas calculates the excess data gas after applying the set of
6969// blobs on top of the excess data gas.
70- func CalcExcessDataGas ( parentExcessDataGas uint64 , parentDataGasUsed uint64 ) uint64 {
71- excessDataGas := parentExcessDataGas + parentDataGasUsed
72- if excessDataGas < params .BlobTxTargetDataGasPerBlock {
70+ func CalcExcessBlobGas ( parentExcessBlobGas uint64 , parentBlobGasUsed uint64 ) uint64 {
71+ excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
72+ if excessBlobGas < params .BlobTxTargetBlobGasPerBlock {
7373 return 0
7474 }
75- return excessDataGas - params .BlobTxTargetDataGasPerBlock
75+ return excessBlobGas - params .BlobTxTargetBlobGasPerBlock
7676}
7777
7878// CalcBlobFee calculates the blobfee from the header's excess data gas field.
79- func CalcBlobFee (excessDataGas uint64 ) * big.Int {
80- return fakeExponential (minDataGasPrice , new (big.Int ).SetUint64 (excessDataGas ), dataGaspriceUpdateFraction )
79+ func CalcBlobFee (excessBlobGas uint64 ) * big.Int {
80+ return fakeExponential (minBlobGasPrice , new (big.Int ).SetUint64 (excessBlobGas ), blobGaspriceUpdateFraction )
8181}
8282
8383// fakeExponential approximates factor * e ** (numerator / denominator) using
0 commit comments