Skip to content

Commit

Permalink
improvs
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech authored and ScottyPoi committed Oct 4, 2024
1 parent 3dc4d4c commit 65fbf73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 10 additions & 0 deletions packages/client/src/rpc/modules/engine/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1523,6 +1523,16 @@ export class Engine {
}

private async getBlobsV1(params: [[Bytes32]]): Promise<(BlobAndProofV1 | null)[]> {
const blobGasLimit = this.config.chainCommon.param('maxblobGasPerBlock')
const blobGasPerBlob = this.config.chainCommon.param('blobGasPerBlob')
const allowedBlobsPerBlock = blobGasLimit / blobGasPerBlob
if (params[0].length > allowedBlobsPerBlock) {
throw {
code: TOO_LARGE_REQUEST,
message: `More than allowedBlobsPerBlock=${allowedBlobsPerBlock} hashes queried`,
}
}

const blobsAndProof: (BlobAndProofV1 | null)[] = []
for (const versionedHashHex of params[0]) {
blobsAndProof.push(this.service.txPool.blobsAndProofsByHash.get(versionedHashHex) ?? null)
Expand Down
10 changes: 4 additions & 6 deletions packages/client/src/service/txpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,10 @@ export class TxPool {
}

pruneBlobsAndProofsCache() {
// currently common.param errors when not achieved cancun hardfork to do the below calculation
// const blobGasLimit = this.config.chainCommon.param('maxblobGasPerBlock')
// const blobGasPerBlob = this.config.chainCommon.param('blobGasPerBlob')
//
// A better way could be figured out to get allowedBlobsPerBlock
const allowedBlobsPerBlock = 6
const blobGasLimit = this.config.chainCommon.param('maxblobGasPerBlock')
const blobGasPerBlob = this.config.chainCommon.param('blobGasPerBlob')
const allowedBlobsPerBlock = Number(blobGasLimit / blobGasPerBlob)

const pruneLength =
this.blobsAndProofsByHash.size - allowedBlobsPerBlock * this.config.blobsAndProofsCacheBlocks
let pruned = 0
Expand Down

0 comments on commit 65fbf73

Please sign in to comment.