# Nimbus # Copyright (c) 2023 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or # http://www.apache.org/licenses/LICENSE-2.0) # * MIT license ([LICENSE-MIT](LICENSE-MIT) or # http://opensource.org/licenses/MIT) # at your option. This file may not be copied, modified, or distributed except # according to those terms. import std/[tables, strutils, typetraits], stint, eth/[common, rlp], eth/common/eth_types_rlp, chronicles, stew/[results, byteutils], kzg4844/kzg_ex as kzg, ../types, ../engine_client, ../../../../nimbus/constants, ../../../../nimbus/core/eip4844, ../../../../nimbus/rpc/rpc_types, ../../../../nimbus/beacon/execution_types, ../../../../nimbus/beacon/web3_eth_conv, ./blobs type TestBlobTxPool* = ref object currentBlobID* : BlobID currentTxIndex*: int transactions* : Table[common.Hash256, Transaction] hashesByIndex* : Table[int, common.Hash256] const HISTORY_BUFFER_LENGTH* = 8191 # Test constants DATAHASH_START_ADDRESS* = toAddress(0x20000.u256) DATAHASH_ADDRESS_COUNT* = 1000 func getMinExcessBlobGasForBlobGasPrice(data_gas_price: uint64): uint64 = var current_excess_data_gas = 0'u64 current_data_gas_price = 1'u64 while current_data_gas_price < data_gas_price: current_excess_data_gas += GAS_PER_BLOB.uint64 current_data_gas_price = getBlobGasPrice(current_excess_data_gas).truncate(uint64) return current_excess_data_gas func getMinExcessBlobsForBlobGasPrice*(data_gas_price: uint64): uint64 = return getMinExcessBlobGasForBlobGasPrice(data_gas_price) div GAS_PER_BLOB.uint64 proc addBlobTransaction*(pool: TestBlobTxPool, tx: Transaction) = let txHash = rlpHash(tx) pool.transactions[txHash] = tx proc `==`(a: openArray[rpc_types.AccessTuple], b: openArray[AccessPair]): bool = if a.len != b.len: return false for i in 0..