-
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
2024-07-25-constants-for-testing #23
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// SPDX-License-Identifier: CAL | ||
pragma solidity ^0.8.18; | ||
|
||
import "openzeppelin-contracts/contracts/utils/introspection/IERC1820Registry.sol"; | ||
|
||
/// @dev https://eips.ethereum.org/EIPS/eip-1820#single-use-registry-deployment-account | ||
IERC1820Registry constant IERC1820_REGISTRY = IERC1820Registry(0x1820a4B7618BdE71Dce8cdc73aAB6C95905faD24); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is actually already in the rain.erc1820 repo https://github.com/rainlanguage/rain.erc1820/blob/main/src/lib/LibIERC1820.sol#L7 |
||
|
||
/// @dev Mocks need to be etched with some bytecode or they cannot even be | ||
/// called. This is because Solidity first checks the bytecode size before | ||
/// calling, so it never even gets to the point that mocking logic can intercept | ||
/// the call. We want all non-mocked calls to revert, so all mocks should be | ||
/// etched with a revert opcode. | ||
bytes constant REVERTING_MOCK_BYTECODE = hex"FD"; | ||
|
||
/// @dev Stub expression bytecode used for testing purposes. | ||
/// This is a simple bytecode stub that can be used as a placeholder for | ||
/// expressions with mock initialization in tests. The bytecode is arbitrary | ||
bytes constant STUB_EXPRESSION_BYTECODE = hex"010000"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we should put abstract stuff for mocking and testing the interpreter in the interpreter interface repo under https://github.com/rainlanguage/rain.interpreter.interface/tree/main/test/abstract |
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.
this is here https://github.com/rainlanguage/rain.erc1820/blob/main/src/interface/IERC1820Registry.sol#L23