Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename data gas to blob gas #626

Merged
merged 1 commit into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions eth/common/eth_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions eth/common/eth_types_rlp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion eth/common/transaction.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion eth/rlp/writer.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/common/test_eip4844.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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) =
Expand Down
4 changes: 2 additions & 2 deletions tests/rlp/test_common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
28 changes: 14 additions & 14 deletions tests/rlp/test_rlp_codec.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down Expand Up @@ -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]
Expand Down