feat : make VaultSecure solution, solve quiz#47
Open
jaesimin0903 wants to merge 1 commit intoBay-17th:mainfrom
Open
feat : make VaultSecure solution, solve quiz#47jaesimin0903 wants to merge 1 commit intoBay-17th:mainfrom
jaesimin0903 wants to merge 1 commit intoBay-17th:mainfrom
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)
이번 주에 배운 것 (2-3가지)
2.재진입 공격 방어 프로세스 CEI 패턴
어려웠던 점과 해결 방법
어려웠던 점:
테스트 기획 의도 파악이 어려웠음.
해결 방법:
질문사항에 서술하겠습니다.
질문 사항
과제를 진행하면서 VaultSecure.sol을 구현하고 테스트를 해보았으나, 로직에 틀린점은 없었지만 Transfer failed 에러가 발생하며 테스트가 실패하는 현상을 발견했습니다.
원인을 분석해 본 결과, 방어 로직이 정상 작동하여 전체 트랜잭션이 안전하게 Revert 처리되는 이더리움의 정상적인 동작을 현재의 테스트 코드가 담아내지 못하고 있는 것 같습니다.
제가 이해한 바로는 다음의 순서로 트랜잭션이 revert되고 있습니다.
이러한 revert 연쇄 현상 때문에, 공격자는 아무런 출금이 되지않아야 한다고 생각합니다.
하지만 현재 테스트 코드의 다음과 같이 작성되어 있습니다.
즉, "방어는 하되 1차 출금은 성공해서 1 ETH를 돌려받아야 한다"는 모순된 기대를 하고 있기 때문에, 정상적으로 전체 트랜잭션을 Revert 시켜버리는 튼튼한 VaultSecure 코드가 도리어 Transfer failed 테스트 실패를 뿜게 되는 것 같습니다.
혹시 이 현상과 관련하여 제가 놓치고 있는 의도가 있을까요? 코드는 방어가 완벽하게 동작하는 현 상태로 제출합니다! 감사합니다.
체크리스트
테스트
forge build성공forge test모든 테스트 통과제출 규칙
{username}/week-{XX}형식.env파일이 커밋에 포함되지 않음