Skip to content

Commit

Permalink
refactor: add fastLaneLengthSlots to getFrameConfig interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurayan committed Sep 11, 2024
1 parent 243f124 commit 5dda4dd
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
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

0 comments on commit 5dda4dd

Please sign in to comment.