feat(week-03): complete week-03 assignment#38
Open
ghwo336 wants to merge 1 commit intoBay-17th:mainfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
과제 제출 정보
주차: Week 03
과제 유형:
구현 내용
배운 점 (What I Learned)
CEI를 만족시키지 않고 컨트랙트를 짠다면, 보안상 큰 문제가 발생할 수도 있다는 것을 배웠습니다.
이번 주에 배운 것 (2-3가지)
어려웠던 점과 해결 방법
어려웠던 점:
해결 방법:
1번 문제 해결방법:
테스트코드를 살펴보니,
// Vault에는 Bob의 5 ETH가 그대로 있어야 함
// (Attacker가 입금한 1 ETH는 정상 출금되어 빠짐)
공격이 실패했을 때 원하시는 동작이 transaction의 revert가 아니고
정상 동작후 정상 종료임을 깨닫고 locked 변수를 추가하여 rever가 안나게 만들어 해결했습니다.
2번 문제 해결 방법:
테스트 코드가 틀렸음을 발견했습니다. attackerBalanceBefore 는 10 ETH이고,
attack 함수를 실행시켰으니 1 ETH만 출금되어야 합니다. 그러면 Attacker의 Ballance는 11ETH가 나오는게 맞는 테스 트 입니다. 따라서 제대로 된 로직이라면 테스트를 실패하는게 당연합니다.
질문 사항
체크리스트
테스트
forge build성공forge test모든 테스트 통과제출 규칙
{username}/week-{XX}형식.env파일이 커밋에 포함되지 않음