rename data gas to blob gas

This commit is contained in:
jangko 2023-07-28 10:19:00 +07:00
parent 15a09fab73
commit 521db96a65
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
7 changed files with 25 additions and 25 deletions

View File

@ -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]

View File

@ -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)

View File

@ -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()

View File

@ -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:

View File

@ -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) =

View File

@ -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()

View File

@ -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]