-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: add log storage contract with frozen past logs #380
Conversation
contracts/utils/FreezeLog.sol
Outdated
) | ||
{ | ||
Log storage log = logs[_recorder][_index]; | ||
require(log.recorder != address(0)); |
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.
viewのfunctionなので、ここは無くても問題にならないと思います。
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.
I completely agree with you.. I removed that require statement.
# Normal | ||
########################################################## | ||
|
||
# Normal_1 |
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.
どの様な観点のケースなのかを書く様にした方が良いです。
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.
I added a summary comment to each test case.
test_freezing_grace_block_count = 5 | ||
|
||
# Record Log | ||
tx = freeze_log.recordLog( |
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.
書き込まれたステートを確認する必要があると思います。
recordLog後、getLogを実行して、書き込まれた内容と一致することをassertするのが良いと思います。
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.
I added some codes after “recordLog” and “updateLog” that ensure chain state changed properly.
tests/utils/test_FreezeLog.py
Outdated
|
||
user1_last_index = freeze_log.lastLogIndex(user1, {"from": user1}) | ||
|
||
tx = freeze_log.updateLog(user1_last_index - 1, test_message[::-1], {"from": user1}) |
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.
上記と同様に、updateされた後のstateの中身が想定通りになっていることを確認した方が良いです
{"from": user1} | ||
) | ||
|
||
with brownie.reverts(revert_msg="frozen"): |
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.
revertされた状態で、getLogをして、ステートの状態がupdate前の状態になっていることを確認するケースにした方が良いと思います
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.
Added codes that checks chain state.
feat: add FreezeLog deployment
Close #375