Skip to content

Commit b03c5c5

Browse files
committed
Merge branch 'CLZ' into fusaka-devnet-2
2 parents 8b72e69 + ca15b24 commit b03c5c5

File tree

8 files changed

+34
-20
lines changed

8 files changed

+34
-20
lines changed

Dockerfile.debug

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,10 @@ COPY ./ /nimbus-eth1
1818

1919
WORKDIR /nimbus-eth1
2020

21-
RUN mv vendor vendor.orig
22-
23-
RUN --mount=type=cache,target=/nimbus-eth1/build --mount=type=cache,target=/nimbus-eth1/vendor \
24-
mv vendor.orig vendor && \
21+
RUN --mount=type=cache,target=/nimbus-eth1/build \
2522
make -j${NPROC} NIMFLAGS="${NIMFLAGS_COMMON} --parallelBuild:${NPROC}" V=1 update
2623

27-
RUN --mount=type=cache,target=/nimbus-eth1/build --mount=type=cache,target=/nimbus-eth1/vendor \
24+
RUN --mount=type=cache,target=/nimbus-eth1/build \
2825
make -j${NPROC} NIMFLAGS="${NIMFLAGS_COMMON} --parallelBuild:${NPROC}" nimbus_execution_client && \
2926
mv build/nimbus_execution_client /usr/local/bin/nimbus_execution_client
3027

execution_chain/constants.nim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,4 @@ const
112112
HISTORY_STORAGE_ADDRESS* = address"0x0000F90827F1C53a10cb7A02335B175320002935"
113113
WITHDRAWAL_REQUEST_PREDEPLOY_ADDRESS* = address"0x00000961Ef480Eb55e80D19ad83579A64c007002"
114114
CONSOLIDATION_REQUEST_PREDEPLOY_ADDRESS* = address"0x0000BBdDc7CE488642fb579F8B00f3a590007251"
115-
116-
MAX_BLOCK_SIZE* = 10_485_760 # 10 MiB
117-
SAFETY_MARGIN* = 2_097_152 # 2 MiB
118-
MAX_RLP_BLOCK_SIZE* = MAX_BLOCK_SIZE - SAFETY_MARGIN
119115
# End

execution_chain/core/executor/process_block.nim

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import
1414
../../common/common,
15-
../../constants,
1615
../../utils/utils,
1716
../../constants,
1817
../../db/ledger,
@@ -119,10 +118,6 @@ proc procBlkPreamble(
119118
if blk.transactions.calcTxRoot != header.txRoot:
120119
return err("Mismatched txRoot")
121120

122-
if com.isOsakaOrLater(header.timestamp):
123-
if rlp.getEncodedLength(blk) > MAX_RLP_BLOCK_SIZE:
124-
return err("Post-Osaka block exceeded MAX_RLP_BLOCK_SIZE")
125-
126121
if com.isPragueOrLater(header.timestamp):
127122
if header.requestsHash.isNone:
128123
return err("Post-Prague block header must have requestsHash")

execution_chain/core/tx_pool.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ proc assembleBlock*(
160160
blobsBundle = BlobsBundle(
161161
wrapperVersion: getWrapperVersion(com, blk.header.timestamp)
162162
)
163-
currentRlpSize = rlp.getEncodedLength(blk.header) + rlp.getEncodedLength(blk.withdrawals)
164163

165164
for item in pst.packedTxs:
166165
let tx = item.pooledTx

execution_chain/evm/interpreter/gas_costs.nim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ template gasCosts(fork: EVMFork, prefix, ResultGasCostsName: untyped) =
520520
Shl: fixed GasVeryLow,
521521
Shr: fixed GasVeryLow,
522522
Sar: fixed GasVeryLow,
523+
Clz: fixed GasVeryLow,
523524

524525
# 20s: SHA3
525526
Sha3: memExpansion `prefix gasSha3`,

execution_chain/evm/interpreter/op_codes.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nimbus
2-
# Copyright (c) 2018-2024 Status Research & Development GmbH
2+
# Copyright (c) 2018-2025 Status Research & Development GmbH
33
# Licensed under either of
44
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
55
# http://www.apache.org/licenses/LICENSE-2.0)
@@ -58,8 +58,9 @@ type
5858
Shl = 0x1B, ## Shift left
5959
Shr = 0x1C, ## Logical shift right
6060
Sar = 0x1D, ## Arithmetic shift right
61+
Clz = 0x1E, ## Count leading zeros
6162

62-
Nop0x1E, Nop0x1F, ## ..
63+
Nop0x1F, ## ..
6364

6465
# 20s: SHA3
6566
Sha3 = 0x20, ## Compute Keccak-256 hash.

execution_chain/evm/interpreter/op_handlers/oph_arithmetic.nim

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Nimbus
2-
# Copyright (c) 2018-2024 Status Research & Development GmbH
2+
# Copyright (c) 2018-2025 Status Research & Development GmbH
33
# Licensed under either of
44
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
55
# http://www.apache.org/licenses/LICENSE-2.0)
@@ -277,6 +277,26 @@ proc sarOp(cpt: VmCpt): EvmResultVoid =
277277

278278
cpt.stack.binaryWithTop(sar256)
279279

280+
proc clzOp(cpt: VmCpt): EvmResultVoid =
281+
## 0x1e, Count Leading Zeros
282+
template clz256(top, value, toStackElem) =
283+
if value.isZero:
284+
toStackElem(256.u256, top)
285+
else:
286+
var count = 0
287+
for i in 0 ..< 32:
288+
let b = (value shr ((31 - i) * 8)).truncate(byte)
289+
if b != 0:
290+
var mask = 0x80'u8
291+
while (b and mask) == 0:
292+
inc count
293+
mask = mask shr 1
294+
break
295+
inc count, 8
296+
toStackElem(count.u256, top)
297+
298+
cpt.stack.unaryWithTop(clz256)
299+
280300
# ------------------------------------------------------------------------------
281301
# Public, op exec table entries
282302
# ------------------------------------------------------------------------------
@@ -460,7 +480,13 @@ const
460480
forks: VmOpConstantinopleAndLater,
461481
name: "sarOp",
462482
info: "Arithmetic shift right",
463-
exec: sarOp)]
483+
exec: sarOp),
484+
485+
(opCode: Clz, ## CLZ (Count Leading Zeros)
486+
forks: VmOpOsakaAndLater, ## Or a newer fork gate, if appropriate
487+
name: "clzOp",
488+
info: "Count leading zero bits in a 256-bit word",
489+
exec: clzOp)]
464490

465491
# ------------------------------------------------------------------------------
466492
# End

execution_chain/evm/interpreter/op_handlers/oph_defs.nim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ const
8888
VmOpOsakaAndLater* =
8989
VmOpPragueAndLater - {FkPrague}
9090

91-
9291
# ------------------------------------------------------------------------------
9392
# End
9493
# ------------------------------------------------------------------------------

0 commit comments

Comments
 (0)