Skip to content
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

Merged
merged 4 commits into from
Apr 5, 2022

Conversation

purplesmoke05
Copy link
Member

Close #375

)
{
Log storage log = logs[_recorder][_index];
require(log.recorder != address(0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

viewのfunctionなので、ここは無くても問題にならないと思います。

Copy link
Member Author

@purplesmoke05 purplesmoke05 Apr 5, 2022

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

どの様な観点のケースなのかを書く様にした方が良いです。

Copy link
Member Author

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(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

書き込まれたステートを確認する必要があると思います。
recordLog後、getLogを実行して、書き込まれた内容と一致することをassertするのが良いと思います。

Copy link
Member Author

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.


user1_last_index = freeze_log.lastLogIndex(user1, {"from": user1})

tx = freeze_log.updateLog(user1_last_index - 1, test_message[::-1], {"from": user1})
Copy link
Member

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"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revertされた状態で、getLogをして、ステートの状態がupdate前の状態になっていることを確認するケースにした方が良いと思います

Copy link
Member Author

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.

@YoshihitoAso YoshihitoAso merged commit 55fc007 into dev-22.6 Apr 5, 2022
@YoshihitoAso YoshihitoAso deleted the feature/#375 branch April 5, 2022 11:22
YoshihitoAso added a commit that referenced this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] New Feature: Log storage contract with frozen past logs
2 participants