duneanalytics / duneanalytics/evm.codes
SMOD description
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 827
- Forks
- 199
- Avg merge
- 15m
- Merged PRs (30d)
- 1
Description
https://www.evm.codes/?fork=cancun#07:
Note the overflow semantic when $−2^{255}$ is negated.
This is a controversial statement for this opcode.
There is no such statement in https://ethereum.github.io/yellowpaper/paper.pdf.
If needed, you may look deeper into implementation details:
-
opSdiv: https://github.com/ethereum/go-ethereum/blob/master/core/vm/instructions.go#L53
-
Sdiv: https://github.com/holiman/uint256/blob/master/uint256.go#L789
-
opSmod: https://github.com/ethereum/go-ethereum/blob/master/core/vm/instructions.go#L65
-
Smod: https://github.com/holiman/uint256/blob/master/uint256.go#L662C1-L682C2
The main point is that SDIV comment—
"Note the overflow semantic when $−2^{255}$ is negated."—
refers to an overflow case.
In contrast, SMOD does not overflow because its arithmetic logic disregards the sign of the second operand.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the SMOD description at the linked evm.codes Cancun opcode page and compare its overflow wording with the Yellow Paper. If needed, inspect the linked opSmod and Smod implementations to understand the disputed behavior. Done means resolving whether the statement belongs in the SMOD description and updating the wording accordingly.
Written by the indexing model from the issue text.
Assessment
- Domain
- blockchain, documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100