-
Notifications
You must be signed in to change notification settings - Fork 24
fix: charge dynamic gas for EXP and LOG in multipass,align log hashing #278
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,4 +56,16 @@ encodeList(const std::vector<std::vector<uint8_t>> &Items) { | |
| return LengthBytes; | ||
| } | ||
|
|
||
| std::vector<uint8_t> | ||
| encodeListFromEncodedItems(const std::vector<std::vector<uint8_t>> &Items) { | ||
| std::vector<uint8_t> Payload; | ||
| for (const auto &Item : Items) { | ||
| Payload.insert(Payload.end(), Item.begin(), Item.end()); | ||
| } | ||
|
|
||
| auto LengthBytes = encodeLength(Payload.size(), RLP_OFFSET_SHORT_LIST); | ||
| LengthBytes.insert(LengthBytes.end(), Payload.begin(), Payload.end()); | ||
| return LengthBytes; | ||
| } | ||
|
Comment on lines
+59
to
+69
|
||
|
|
||
| } // namespace zen::evm::rlp | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,48 @@ | ||||||||||
| """ | ||||||||||
| Test EXP opcode. | ||||||||||
| """ | ||||||||||
|
|
||||||||||
| import pytest | ||||||||||
| from execution_testing import ( | ||||||||||
| Alloc, | ||||||||||
| Fork, | ||||||||||
| Op, | ||||||||||
| StateTestFiller, | ||||||||||
| gas_test, | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| REFERENCE_SPEC_GIT_PATH = "N/A" | ||||||||||
| REFERENCE_SPEC_VERSION = "N/A" | ||||||||||
|
Comment on lines
+14
to
+15
|
||||||||||
| REFERENCE_SPEC_GIT_PATH = "N/A" | |
| REFERENCE_SPEC_VERSION = "N/A" | |
| REFERENCE_SPEC_GIT_PATH = "EIPS/eip-160.md" | |
| REFERENCE_SPEC_VERSION = "EIP-160" |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter name "a" is ambiguous. It should be renamed to "base" to match the EXP opcode semantics where EXP takes two operands: base and exponent. This would make the test more readable and align with the variable names used in the implementation (Base and Exponent in opcode_handlers.cpp line 316-317).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional check for LogDataCost != 0 before charging gas is unnecessary. Similar to the EXP opcode issue, when Size is 0, LogDataCost will be 0, and chargeGas with 0 is safe. This check is inconsistent with the interpreter implementation in opcode_handlers.cpp (line 1511) which doesn't have this conditional. Remove the conditional to maintain consistency.