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: empty initial network state #352

Merged
merged 21 commits into from
Aug 26, 2024
Merged

feat: empty initial network state #352

merged 21 commits into from
Aug 26, 2024

Conversation

daejunpark
Copy link
Collaborator

@daejunpark daejunpark commented Aug 23, 2024

changes:

old new
*.balance symbolic zero
msg.sender 0xaaaa0000 foundry caller address
tx.origin symbolic foundry caller address
this 0xaaaa0001 foundry test contract address
block.* symbolic foundry default

@daejunpark daejunpark mentioned this pull request Aug 24, 2024
13 tasks
def mk_this() -> Address:
# NOTE: Do NOT remove the `con_addr()` wrapper.
# The return type should be BitVecSort(160) as it is used as a key for ex.code.
# The keys of ex.code are compared using structural equality with other BitVecRef addresses.
return con_addr(magic_address + 1)
return con_addr(FOUNDRY_TEST)
Copy link
Collaborator

Choose a reason for hiding this comment

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

might be nice to standardize on address() rather than con_addr(), wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good idea. they are slightly different though right now--value range check only in con_addr. perhaps it would be better to add the value range check in the con(), and then replace con_addr() with address(). but we need to make sure this doesn't break others. let's work on it in a separate pr.

@@ -687,7 +690,7 @@ def handle(sevm, ex, arg: ByteVec, stack, step_id) -> ByteVec | None:

return ret

# getBlockNumber() return (uint256)
# vm.getBlockNumber() return (uint256)
elif funsig == hevm_cheat_code.get_block_nunber_sig:
Copy link
Collaborator

Choose a reason for hiding this comment

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

unrelated, but typo here

Suggested change
elif funsig == hevm_cheat_code.get_block_nunber_sig:
elif funsig == hevm_cheat_code.get_block_number_sig:

Copy link
Collaborator

Choose a reason for hiding this comment

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

(needs to be fixed at definition site too)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch, fixed, thanks!

Comment on lines -168 to -177
symbolic_msg_sender: bool = arg(
help="set msg.sender symbolic",
global_default=False,
)

no_test_constructor: bool = arg(
help="do not run the constructor of test contracts",
global_default=False,
)

Copy link
Collaborator

Choose a reason for hiding this comment

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

we're really cleaning up 🤗

@@ -6,6 +6,10 @@ import "forge-std/Test.sol";
contract DealTest is Test {
C c;

function check_initial_balance(address addr) public {
assertEq(addr.balance, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@daejunpark daejunpark merged commit 998b282 into main Aug 26, 2024
57 checks passed
@daejunpark daejunpark deleted the feat/empty-initial-state branch August 26, 2024 21:55
@daejunpark daejunpark restored the feat/empty-initial-state branch August 26, 2024 22:00
@daejunpark daejunpark deleted the feat/empty-initial-state branch August 26, 2024 22:03
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.

2 participants