-
Notifications
You must be signed in to change notification settings - Fork 69
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
remove epoch related code from light client contract #1934
remove epoch related code from light client contract #1934
Conversation
/// @dev Fetches the current epoch from the light client contract. | ||
/// @return current epoch (computed from the current block) | ||
function currentEpoch() public view returns (uint64) { | ||
return lightClient.currentEpoch(); | ||
function currentEpoch() public pure returns (uint64) { |
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.
Why do we need to keep the function currentEpoch()
?
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.
at the time i made the change, i wanted to keep the related tests with as little breaking changes as possible - but now that i removed the stateTable tests, i can remove that 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 also agree to keep this, a dummy logic is perfect here. Plus we are not using or auditing this contract anyway.
contracts/test/LightClient.t.sol
Outdated
@@ -21,7 +21,7 @@ contract LightClientCommonTest is Test { | |||
uint32 public constant BLOCKS_PER_EPOCH_TEST = 3; | |||
uint32 public constant DELAY_THRESHOLD = 6; | |||
uint32 public constant MAX_HISTORY_SECONDS = 1 days; | |||
uint32 initialEpoch = 1 days; | |||
uint32 public initialEpoch = 1 days; |
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.
Why do we need to keep this variable?
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.
ah this epoch isn't used for testing the block per epoch functionality but for testing the retention period for storing the state history on the contract
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 see, should we change the name to avoid confusion?
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.
done here 5acfd94
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.
Thanks for the work! 👍
/// @dev Fetches the current epoch from the light client contract. | ||
/// @return current epoch (computed from the current block) | ||
function currentEpoch() public view returns (uint64) { | ||
return lightClient.currentEpoch(); | ||
function currentEpoch() public pure returns (uint64) { |
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 also agree to keep this, a dummy logic is perfect here. Plus we are not using or auditing this contract anyway.
/// Number of blocks per epoch for testing | ||
pub const BLOCKS_PER_EPOCH: u32 = 3; | ||
|
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.
can we set to u32::MAX
for now?
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.
since the blocks_per_epoch is used to determine how many states to generate, which is then used in the tests, I would say we need to choose a small number. I would opt for 5 though
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.
okay, sounds good.
…s from forge test when using just sol-test
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.
LGTM, one comment is: instead of forge test --no-match-contract, can we edit foundry.toml to ignore?
Because locally I won't have to remember to add that flag to forge commands all the time.
Thanks!
…poch-related-code
@alxiong I agree, however, |
…st sol-test and proceed with changes to the diff-test
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.
LGTM
Closes #1928
This PR:
Simplifies the Light Client contract by removing any functionality related to epochs since epochs have not been implemented yet. Code Changes:
blocksPerEpoch
variablecurrentEpoch
variablecurrentEpoch()
This PR does not:
just sol-test
Key places to review: