From 521db96a651f582c937a0bb8c8069ef9b920e08c Mon Sep 17 00:00:00 2001 From: jangko Date: Fri, 28 Jul 2023 10:19:00 +0700 Subject: [PATCH] rename data gas to blob gas --- eth/common/eth_types.nim | 6 +++--- eth/common/eth_types_rlp.nim | 4 ++-- eth/common/transaction.nim | 2 +- eth/rlp/writer.nim | 2 +- tests/common/test_eip4844.nim | 4 ++-- tests/rlp/test_common.nim | 4 ++-- tests/rlp/test_rlp_codec.nim | 28 ++++++++++++++-------------- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/eth/common/eth_types.nim b/eth/common/eth_types.nim index 1e2226a..7ebd89b 100644 --- a/eth/common/eth_types.nim +++ b/eth/common/eth_types.nim @@ -98,7 +98,7 @@ type value* : UInt256 payload* : Blob accessList* : AccessList # EIP-2930 - maxFeePerDataGas*: GasInt # EIP-4844 + maxFeePerBlobGas*: GasInt # EIP-4844 versionedHashes*: VersionedHashes # EIP-4844 networkPayload*: NetworkPayload # EIP-4844 V* : int64 @@ -141,8 +141,8 @@ type # `baseFee` is the get/set of `fee` fee*: Option[UInt256] # EIP-1559 withdrawalsRoot*: Option[Hash256] # EIP-4895 - dataGasUsed*: Option[uint64] # EIP-4844 - excessDataGas*: Option[uint64] # EIP-4844 + blobGasUsed*: Option[uint64] # EIP-4844 + excessBlobGas*: Option[uint64] # EIP-4844 BlockBody* = object transactions*: seq[Transaction] diff --git a/eth/common/eth_types_rlp.nim b/eth/common/eth_types_rlp.nim index df88612..058769b 100644 --- a/eth/common/eth_types_rlp.nim +++ b/eth/common/eth_types_rlp.nim @@ -125,7 +125,7 @@ proc appendTxEip4844Signed(w: var RlpWriter, tx: Transaction) = w.append(tx.value) w.append(tx.payload) w.append(tx.accessList) - w.append(tx.maxFeePerDataGas) + w.append(tx.maxFeePerBlobGas) w.append(tx.versionedHashes) w.append(tx.V) w.append(tx.R) @@ -224,7 +224,7 @@ proc readTxEip4844Signed(rlp: var Rlp, tx: var Transaction) = rlp.read(tx.value) rlp.read(tx.payload) rlp.read(tx.accessList) - rlp.read(tx.maxFeePerDataGas) + rlp.read(tx.maxFeePerBlobGas) rlp.read(tx.versionedHashes) rlp.read(tx.V) rlp.read(tx.R) diff --git a/eth/common/transaction.nim b/eth/common/transaction.nim index 528f76a..a5caaea 100644 --- a/eth/common/transaction.nim +++ b/eth/common/transaction.nim @@ -98,7 +98,7 @@ func rlpEncodeEip4844(tx: Transaction): auto = w.append(tx.value) w.append(tx.payload) w.append(tx.accessList) - w.append(tx.maxFeePerDataGas) + w.append(tx.maxFeePerBlobGas) w.append(tx.versionedHashes) w.finish() diff --git a/eth/rlp/writer.nim b/eth/rlp/writer.nim index 7687f11..d1cc97f 100644 --- a/eth/rlp/writer.nim +++ b/eth/rlp/writer.nim @@ -243,7 +243,7 @@ macro genOptionalFieldsValidation(obj: untyped, T: type, num: static[int]): unty # generate something like when false: - if obj.excessDataGas.isSome: + if obj.excessBlobGas.isSome: doAssert(obj.withdrawalsRoot.isSome, "withdrawalsRoot expected") doAssert(obj.fee.isSome, "fee expected") if obj.withdrawalsRoot.isSome: diff --git a/tests/common/test_eip4844.nim b/tests/common/test_eip4844.nim index e974772..9af8958 100644 --- a/tests/common/test_eip4844.nim +++ b/tests/common/test_eip4844.nim @@ -120,7 +120,7 @@ proc tx7(i: int): Transaction = maxFee: 10.GasInt, accessList: accesses, versionedHashes: @[digest], - maxFeePerDataGas: 10000000.GasInt, + maxFeePerBlobGas: 10000000.GasInt, ) proc tx8(i: int): Transaction = @@ -137,7 +137,7 @@ proc tx8(i: int): Transaction = maxFee: 10.GasInt, accessList: accesses, versionedHashes: @[digest], - maxFeePerDataGas: 10000000.GasInt, + maxFeePerBlobGas: 10000000.GasInt, ) template roundTrip(txFunc: untyped, i: int) = diff --git a/tests/rlp/test_common.nim b/tests/rlp/test_common.nim index 886911a..e3cbd06 100644 --- a/tests/rlp/test_common.nim +++ b/tests/rlp/test_common.nim @@ -116,8 +116,8 @@ proc suite2() = doTest h # EIP-4844 - h.dataGasUsed = some 1234'u64 - h.excessDataGas = some 1234'u64 + h.blobGasUsed = some 1234'u64 + h.excessBlobGas = some 1234'u64 doTest h suite1() diff --git a/tests/rlp/test_rlp_codec.nim b/tests/rlp/test_rlp_codec.nim index ec80a9f..f5b99ef 100644 --- a/tests/rlp/test_rlp_codec.nim +++ b/tests/rlp/test_rlp_codec.nim @@ -61,28 +61,28 @@ suite "BlockHeader roundtrip test": expect AssertionDefect: roundTrip(h) - test "Header + none(baseFee) + some(withdrawalsRoot) + some(excessDataGas)": + test "Header + none(baseFee) + some(withdrawalsRoot) + some(excessBlobGas)": let h = BlockHeader( withdrawalsRoot: some(Hash256()), - dataGasUsed: some(1'u64), - excessDataGas: some(1'u64) + blobGasUsed: some(1'u64), + excessBlobGas: some(1'u64) ) expect AssertionDefect: roundTrip(h) - test "Header + none(baseFee) + none(withdrawalsRoot) + some(excessDataGas)": + test "Header + none(baseFee) + none(withdrawalsRoot) + some(excessBlobGas)": let h = BlockHeader( - dataGasUsed: some(1'u64), - excessDataGas: some(1'u64) + blobGasUsed: some(1'u64), + excessBlobGas: some(1'u64) ) expect AssertionDefect: roundTrip(h) - test "Header + some(baseFee) + none(withdrawalsRoot) + some(excessDataGas)": + test "Header + some(baseFee) + none(withdrawalsRoot) + some(excessBlobGas)": let h = BlockHeader( fee: some(2.u256), - dataGasUsed: some(1'u64), - excessDataGas: some(1'u64) + blobGasUsed: some(1'u64), + excessBlobGas: some(1'u64) ) expect AssertionDefect: roundTrip(h) @@ -94,12 +94,12 @@ suite "BlockHeader roundtrip test": ) roundTrip(h) - test "Header + some(baseFee) + some(withdrawalsRoot) + some(excessDataGas)": + test "Header + some(baseFee) + some(withdrawalsRoot) + some(excessBlobGas)": let h = BlockHeader( fee: some(2.u256), withdrawalsRoot: some(Hash256()), - dataGasUsed: some(1'u64), - excessDataGas: some(1'u64) + blobGasUsed: some(1'u64), + excessBlobGas: some(1'u64) ) roundTrip(h) @@ -177,8 +177,8 @@ type nonce*: BlockNonce fee*: Opt[UInt256] withdrawalsRoot*: Opt[Hash256] - dataGasUsed*: Opt[GasInt] - excessDataGas*: Opt[GasInt] + blobGasUsed*: Opt[GasInt] + excessBlobGas*: Opt[GasInt] BlockBodyOpt* = object transactions*: seq[Transaction]