params: revert change of target blob gas var

This commit is contained in:
lightclient 2023-09-03 15:11:32 -06:00
parent 193fd7daa1
commit 66e7fa48a1
No known key found for this signature in database
GPG key ID: 75C916AFEE20183E
3 changed files with 12 additions and 12 deletions

View file

@ -69,10 +69,10 @@ func VerifyEIP4844Header(parent, header *types.Header) error {
// blobs on top of the excess blob gas. // blobs on top of the excess blob gas.
func CalcExcessBlobGas(parentExcessBlobGas uint64, parentBlobGasUsed uint64) uint64 { func CalcExcessBlobGas(parentExcessBlobGas uint64, parentBlobGasUsed uint64) uint64 {
excessBlobGas := parentExcessBlobGas + parentBlobGasUsed excessBlobGas := parentExcessBlobGas + parentBlobGasUsed
if excessBlobGas < params.TargetBlobGasPerBlock { if excessBlobGas < params.BlobTxTargetBlobGasPerBlock {
return 0 return 0
} }
return excessBlobGas - params.TargetBlobGasPerBlock return excessBlobGas - params.BlobTxTargetBlobGasPerBlock
} }
// CalcBlobFee calculates the blobfee from the header's excess blob gas field. // CalcBlobFee calculates the blobfee from the header's excess blob gas field.

View file

@ -34,20 +34,20 @@ func TestCalcExcessBlobGas(t *testing.T) {
// slots are below - or equal - to the target. // slots are below - or equal - to the target.
{0, 0, 0}, {0, 0, 0},
{0, 1, 0}, {0, 1, 0},
{0, params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, 0}, {0, params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, 0},
// If the target blob gas is exceeded, the excessBlobGas should increase // If the target blob gas is exceeded, the excessBlobGas should increase
// by however much it was overshot // by however much it was overshot
{0, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob}, {0, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob},
{1, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob + 1}, {1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 1, params.BlobTxBlobGasPerBlob + 1},
{1, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 2, 2*params.BlobTxBlobGasPerBlob + 1}, {1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) + 2, 2*params.BlobTxBlobGasPerBlob + 1},
// The excess blob gas should decrease by however much the target was // The excess blob gas should decrease by however much the target was
// under-shot, capped at zero. // under-shot, capped at zero.
{params.TargetBlobGasPerBlock, params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, params.TargetBlobGasPerBlock}, {params.BlobTxTargetBlobGasPerBlock, params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, params.BlobTxTargetBlobGasPerBlock},
{params.TargetBlobGasPerBlock, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, params.BlobTxBlobGasPerBlob}, {params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, params.BlobTxBlobGasPerBlob},
{params.TargetBlobGasPerBlock, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 2, 0}, {params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 2, 0},
{params.BlobTxBlobGasPerBlob - 1, (params.TargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, 0}, {params.BlobTxBlobGasPerBlob - 1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, 0},
} }
for _, tt := range tests { for _, tt := range tests {
result := CalcExcessBlobGas(tt.excess, tt.blobs*params.BlobTxBlobGasPerBlob) result := CalcExcessBlobGas(tt.excess, tt.blobs*params.BlobTxBlobGasPerBlob)

View file

@ -173,7 +173,7 @@ const (
BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile. BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile.
MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block
TargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing) BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable blob gas for data blobs per block (for 1559-like pricing)
) )
// Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations // Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations