Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common: update the blob target and limit to 3/6 respectively #2775

Merged
merged 5 commits into from
Jun 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/block/test/eip4844block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,16 +133,17 @@ tape('data gas tests', async (t) => {
t.equal(excessDataGas, 0n, 'excess data gas should be 0 for small parent header data gas')
t.equal(dataGasPrice, 1n, 'data gas price should be 1n when low or no excess data gas')
const highGasHeader = BlockHeader.fromHeaderData(
{ number: 1, excessDataGas: 4194304, dataGasUsed: BigInt(4) * dataGasPerBlob },
{ number: 1, excessDataGas: 6291456, dataGasUsed: BigInt(6) * dataGasPerBlob },
{ common, skipConsensusFormatValidation: true }
)
excessDataGas = highGasHeader.calcNextExcessDataGas()
dataGasPrice = highGasHeader.getDataGasPrice()
t.equal(excessDataGas, 4456448n)
t.equal(excessDataGas, 6684672n)
t.equal(dataGasPrice, 6n, 'computed correct data gas price')

t.equal(lowGasHeader.calcDataFee(1), 131072n, 'compute data fee correctly')
t.equal(highGasHeader.calcDataFee(4), 3145728n, 'compute data fee correctly')
t.equal(highGasHeader.calcDataFee(6), 4718592n, 'compute data fee correctly')
t.end()
}
})
Expand Down Expand Up @@ -208,7 +209,7 @@ tape('transaction validation tests', async (t) => {

const blockWithInvalidTx = getBlock([tx1, tx2])

const blockWithTooManyBlobs = getBlock([tx1, tx1, tx1, tx1, tx1])
const blockWithTooManyBlobs = getBlock([tx1, tx1, tx1, tx1, tx1, tx1, tx1])

t.doesNotThrow(
() => blockWithValidTx.validateBlobTransactions(parentHeader),
Expand Down Expand Up @@ -241,7 +242,8 @@ tape('transaction validation tests', async (t) => {

t.ok(
blockWithTooManyBlobs
.validateTransactions(true)[4]
.validateTransactions(true)
.join(' ')
.includes('exceed maximum data gas per block'),
'tx erros includes correct error message when too many blobs in a block'
)
Expand Down
2 changes: 1 addition & 1 deletion packages/block/test/from-beacon-payload.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ tape('[fromExecutionPayloadJson]: 4844 devnet 5', async function (t) {
try {
const block = await Block.fromBeaconPayloadJson(payload, { common })
const parentHeader = BlockHeader.fromHeaderData(
{ excessDataGas: BigInt(0), dataGasUsed: block.header.excessDataGas! + BigInt(262144) },
{ excessDataGas: BigInt(0), dataGasUsed: block.header.excessDataGas! + BigInt(393216) },
{ common }
)
block.validateBlobTransactions(parentHeader)
Expand Down
14 changes: 7 additions & 7 deletions packages/client/test/miner/pendingBlock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ tape('[PendingBlock]', async (t) => {
for (let x = 0; x <= 2; x++) {
const txA01 = BlobEIP4844Transaction.fromTxData(
{
versionedHashes,
blobs: [...blobs, ...blobs],
kzgCommitments: [...commitments, ...commitments],
kzgProofs: [...proofs, ...proofs],
versionedHashes: [...versionedHashes, ...versionedHashes, ...versionedHashes],
blobs: [...blobs, ...blobs, ...blobs],
kzgCommitments: [...commitments, ...commitments, ...commitments],
kzgProofs: [...proofs, ...proofs, ...proofs],
maxFeePerDataGas: 100000000n,
gasLimit: 0xffffffn,
maxFeePerGas: 1000000000n,
Expand Down Expand Up @@ -380,9 +380,9 @@ tape('[PendingBlock]', async (t) => {

st.ok(block !== undefined && blobsBundles !== undefined)
st.equal(block!.transactions.length, 2, 'Only two blob txs should be included')
st.equal(blobsBundles!.blobs.length, 4, 'maximum 4 blobs should be included')
st.equal(blobsBundles!.commitments.length, 4, 'maximum 4 commitments should be included')
st.equal(blobsBundles!.proofs.length, 4, 'maximum 4 proofs should be included')
st.equal(blobsBundles!.blobs.length, 6, 'maximum 6 blobs should be included')
st.equal(blobsBundles!.commitments.length, 6, 'maximum 6 commitments should be included')
st.equal(blobsBundles!.proofs.length, 6, 'maximum 6 proofs should be included')

const pendingBlob = blobsBundles!.blobs[0]
st.ok(pendingBlob !== undefined && equalsBytes(pendingBlob, blobs[0]))
Expand Down
6 changes: 3 additions & 3 deletions packages/common/src/eips/4844.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
"d": "The base fee for data gas per blob"
},
"targetDataGasPerBlock": {
"v": 262144,
"v": 393216,
"d": "The target data gas consumed per block"
},
"maxDataGasPerBlock": {
"v": 524288,
"v": 786432,
"d": "The max data gas allowable per block"
},
"dataGasPriceUpdateFraction": {
"v": 2225652,
"v": 3338477,
"d": "The denominator used in the exponential when calculating a data gas price"
}
},
Expand Down