Skip to content

Commit cebe5ee

Browse files
committedMay 30, 2024
Copy EIP-4844 properties during estimateGas and call (#4728).
1 parent 5463aa0 commit cebe5ee

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed
 

‎src.ts/providers/provider-etherscan.ts

+11
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,21 @@ export class EtherscanProvider extends AbstractProvider {
340340
// Quantity-types require no leading zero, unless 0
341341
if ((<any>{ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true })[key]) {
342342
value = toQuantity(value);
343+
343344
} else if (key === "accessList") {
344345
value = "[" + accessListify(value).map((set) => {
345346
return `{address:"${ set.address }",storageKeys:["${ set.storageKeys.join('","') }"]}`;
346347
}).join(",") + "]";
348+
349+
} else if (key === "blobVersionedHashes") {
350+
if (value.length === 0) { continue; }
351+
352+
// @TODO: update this once the API supports blobs
353+
assert(false, "Etherscan API does not support blobVersionedHashes", "UNSUPPORTED_OPERATION", {
354+
operation: "_getTransactionPostData",
355+
info: { transaction }
356+
});
357+
347358
} else {
348359
value = hexlify(value);
349360
}

‎src.ts/providers/provider-jsonrpc.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {
655655
if (req.method === "call" || req.method === "estimateGas") {
656656
let tx = req.transaction;
657657
if (tx && tx.type != null && getBigInt(tx.type)) {
658-
// If there are no EIP-1559 properties, it might be non-EIP-a559
658+
// If there are no EIP-1559 or newer properties, it might be pre-EIP-1559
659659
if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) {
660660
const feeData = await this.getFeeData();
661661
if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) {
@@ -845,6 +845,16 @@ export abstract class JsonRpcApiProvider extends AbstractProvider {
845845
result["accessList"] = accessListify(tx.accessList);
846846
}
847847

848+
if (tx.blobVersionedHashes) {
849+
// @TODO: Remove this <any> case once EIP-4844 added to prepared tx
850+
(<any>result)["blobVersionedHashes"] = tx.blobVersionedHashes.map(h => h.toLowerCase());
851+
}
852+
853+
// @TODO: blobs should probably also be copied over, optionally
854+
// accounting for the kzg property to backfill blobVersionedHashes
855+
// using the commitment. Or should that be left as an exercise to
856+
// the caller?
857+
848858
return result;
849859
}
850860

0 commit comments

Comments
 (0)
Please sign in to comment.