Workspace IndexKnowledge Notes › Integer overflow — arithmetic that wraps past zero

#227PoC

Integer overflow — arithmetic that wraps past zero

Before Solidity 0.8 made checks default, unchecked arithmetic could wrap a balance from near-zero to near-max, and the pattern survives today in unchecked blocks and other languages.

Not yet scoped.

Why

The PoC demonstrates an overflow in an unchecked block and contrasts it with SafeMath and native 0.8 checks, making the invisible wrap explicit.

How it works

Not yet built.

Where it lands in Jayverse

  • Verex/contracts: add a CI grep check for unchecked blocks that requires an explicit comment justifying safety. Solidity 0.8's default checks don't cover intentional unchecked math, and that's exactly where this PoC's wrap lives.
  • Devnet: add the overflow-wrap PoC (unchecked vs SafeMath vs native 0.8 checks) as a regression test in the contracts test suite, so the fix is demonstrated in CI rather than assumed from the compiler version alone.

Key expressions

Words and phrases from this page worth keeping, with the Korean meaning and the sentence they come from.

Expression뜻 · 쓰이는 자리
wrap (past zero)(숫자가 한계를 넘어) 순환해 되돌아가다 · 정수가 최대값을 넘으면 0 근처로 되돌아가는 현상. "arithmetic that wraps past zero"
unchecked block(오버플로우) 검사를 생략한 블록 · Solidity에서 의도적으로 검사를 끄는 코드 구간. "demonstrates an overflow in an unchecked block"
survive (the pattern survives)(문제·관행이) 여전히 남아있다 · 옛 취약점 패턴이 오늘날에도 존재함을 가리키는 동사. "the pattern survives today in unchecked blocks"
contrast with~와 대조하다·대비시키다 · 취약한 코드와 안전한 코드를 나란히 비교할 때. "contrasts it with SafeMath and native"
make explicit(눈에 안 보이던 것을) 명시적으로 드러내다 · 조용히 일어나는 오버플로우를 눈에 보이게 만든다는 뜻. "making the invisible wrap explicit"
SafeMath오버플로우를 검사하는 산술 라이브러리(a checked-arithmetic library) · Solidity 0.8 이전에 오버플로우를 막던 방식, 네이티브 검사와 대조군으로 언급됨. "contrasts it with SafeMath and native 0.8 checks"

← All Knowledge Notes · Workspace Index · Top ↑

정수 오버플로 — 0을 지나 되감기는 산술

Solidity 0.8이 검사를 기본으로 만들기 전, 검사 없는 산술은 잔액을 0 근처에서 최댓값 근처로 되감을 수 있었고, 이 패턴은 오늘날 unchecked 블록과 다른 언어에 남아 있습니다.

아직 범위 미정.

이 PoC는 unchecked 블록의 오버플로를 시연하고 이를 SafeMath 및 0.8 네이티브 검사와 대조해, 보이지 않는 되감김을 드러냅니다.

동작 방식

아직 만들지 않음.

Jayverse에서의 위치

  • Verex/contracts: unchecked 블록에 대해 안전성을 정당화하는 명시적 주석을 요구하는 CI grep 체크를 추가한다. Solidity 0.8의 기본 체크는 의도적인 unchecked 연산을 커버하지 않으며, 이 PoC의 wrap이 바로 거기서 일어난다.
  • Devnet: overflow-wrap PoC(unchecked 대 SafeMath 대 네이티브 0.8 체크)를 컨트랙트 테스트 스위트의 회귀 테스트로 추가한다. 컴파일러 버전만으로 가정하지 않고 CI에서 고침이 실증되게 한다.

핵심 표현

이 페이지의 영어 본문에서 배울 만한 단어와 표현, 뜻과 나온 자리.

Expression뜻 · 쓰이는 자리
wrap (past zero)(숫자가 한계를 넘어) 순환해 되돌아가다 · 정수가 최대값을 넘으면 0 근처로 되돌아가는 현상. "arithmetic that wraps past zero"
unchecked block(오버플로우) 검사를 생략한 블록 · Solidity에서 의도적으로 검사를 끄는 코드 구간. "demonstrates an overflow in an unchecked block"
survive (the pattern survives)(문제·관행이) 여전히 남아있다 · 옛 취약점 패턴이 오늘날에도 존재함을 가리키는 동사. "the pattern survives today in unchecked blocks"
contrast with~와 대조하다·대비시키다 · 취약한 코드와 안전한 코드를 나란히 비교할 때. "contrasts it with SafeMath and native"
make explicit(눈에 안 보이던 것을) 명시적으로 드러내다 · 조용히 일어나는 오버플로우를 눈에 보이게 만든다는 뜻. "making the invisible wrap explicit"
SafeMath오버플로우를 검사하는 산술 라이브러리(a checked-arithmetic library) · Solidity 0.8 이전에 오버플로우를 막던 방식, 네이티브 검사와 대조군으로 언급됨. "contrasts it with SafeMath and native 0.8 checks"

← 전체 기술 노트 · 워크스페이스 인덱스 · 맨 위 ↑