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

refactor: Add fastLaneLengthSlots to getFrameConfig interface #865

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions contracts/0.4.24/oracle/LegacyOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ interface IHashConsensus {

function getFrameConfig() external view returns (
uint256 initialEpoch,
uint256 epochsPerFrame
uint256 epochsPerFrame,
uint256 fastLaneLengthSlots
);

function getCurrentFrame() external view returns (
Expand Down Expand Up @@ -147,7 +148,7 @@ contract LegacyOracle is Versioned, AragonApp {
uint64 genesisTime
)
{
(, uint256 epochsPerFrame_) = _getAccountingConsensusContract().getFrameConfig();
(, uint256 epochsPerFrame_,) = _getAccountingConsensusContract().getFrameConfig();
epochsPerFrame = uint64(epochsPerFrame_);

ChainSpec memory spec = _getChainSpec();
Expand Down Expand Up @@ -365,7 +366,7 @@ contract LegacyOracle is Versioned, AragonApp {
{
IHashConsensus consensus = IHashConsensus(_accountingOracleConsensusContract);
(uint256 slotsPerEpoch, uint256 secondsPerSlot, uint256 genesisTime) = consensus.getChainConfig();
(, uint256 epochsPerFrame_) = consensus.getFrameConfig();
(, uint256 epochsPerFrame_,) = consensus.getFrameConfig();

spec.epochsPerFrame = uint64(epochsPerFrame_);
spec.slotsPerEpoch = uint64(slotsPerEpoch);
Expand Down
2 changes: 1 addition & 1 deletion contracts/0.8.9/oracle/AccountingOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ contract AccountingOracle is BaseOracle {
internal view returns (uint256)
{
(uint256 initialEpoch,
uint256 epochsPerFrame) = IConsensusContract(consensusContract).getFrameConfig();
uint256 epochsPerFrame,) = IConsensusContract(consensusContract).getFrameConfig();

(uint256 slotsPerEpoch,
uint256 secondsPerSlot,
Expand Down
6 changes: 5 additions & 1 deletion contracts/0.8.9/oracle/BaseOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ interface IConsensusContract {
uint256 genesisTime
);

function getFrameConfig() external view returns (uint256 initialEpoch, uint256 epochsPerFrame);
function getFrameConfig() external view returns (
uint256 initialEpoch,
uint256 epochsPerFrame,
uint256 fastLaneLengthSlots
);

function getInitialRefSlot() external view returns (uint256);
}
Expand Down
5 changes: 3 additions & 2 deletions test/0.4.24/contracts/HashConsensus__MockForLegacyOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ contract HashConsensus__MockForLegacyOracle is IHashConsensus {

function getFrameConfig() external view returns (
uint256 initialEpoch,
uint256 epochsPerFrame
uint256 epochsPerFrame,
uint256 fastLaneLengthSlots
) {
FrameConfig memory config = _frameConfig;
return (config.initialEpoch, config.epochsPerFrame);
return (config.initialEpoch, config.epochsPerFrame, config.fastLaneLengthSlots);
}

function getCurrentFrame() external view returns (
Expand Down
4 changes: 2 additions & 2 deletions test/0.8.9/contracts/MockConsensusContract.sol
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ contract MockConsensusContract is IConsensusContract {
function getFrameConfig()
external
view
returns (uint256 initialEpoch, uint256 epochsPerFrame)
returns (uint256 initialEpoch, uint256 epochsPerFrame, uint256 fastLaneLengthSlots)
{
return (_frameConfig.initialEpoch, _frameConfig.epochsPerFrame);
return (_frameConfig.initialEpoch, _frameConfig.epochsPerFrame, _frameConfig.fastLaneLengthSlots);
}

function getInitialRefSlot() external view returns (uint256) {
Expand Down
Loading