Skip to content

Commit

Permalink
fixed missing pieces of coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey committed Aug 11, 2023
1 parent 2594e08 commit 6a8ae06
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 68 deletions.
2 changes: 1 addition & 1 deletion contracts/external/oracles/ChainlinkOracleSentinel.sol
Expand Up @@ -59,7 +59,7 @@ contract ChainlinkOracleSentinel is IOracleSentinel, OnlyDolomiteMargin {
public
OnlyDolomiteMargin(_dolomiteMargin)
{
gracePeriod = _gracePeriod;
_ownerSetGracePeriod(_gracePeriod);
SEQUENCER_UPTIME_FEED = IChainlinkAggregator(_sequencerUptimeFeed);
}

Expand Down
18 changes: 9 additions & 9 deletions contracts/external/oracles/ChainlinkPriceOracleV1.sol
Expand Up @@ -77,20 +77,20 @@ contract ChainlinkPriceOracleV1 is IChainlinkPriceOracleV1, OnlyDolomiteMargin {
public
OnlyDolomiteMargin(_dolomiteMargin)
{
// coverage-disable-next-line
require(
Require.that(
_tokens.length == _chainlinkAggregators.length,
"Invalid aggregators"
FILE,
"Invalid tokens length"
);
// coverage-disable-next-line
require(
Require.that(
_chainlinkAggregators.length == _tokenDecimals.length,
"Invalid token decimals"
FILE,
"Invalid aggregators length"
);
// coverage-disable-next-line
require(
Require.that(
_tokenDecimals.length == _tokenPairs.length,
"Invalid token pairs"
FILE,
"Invalid decimals length"
);

uint256 tokensLength = _tokens.length;
Expand Down
Expand Up @@ -52,12 +52,14 @@ contract ChainlinkOracleSentinel is IOracleSentinel, OnlyDolomiteMargin {
* online.
*/
constructor(
uint256 _gracePeriod,
address _sequencerUptimeFeed,
address _dolomiteMargin
)
public
OnlyDolomiteMargin(_dolomiteMargin)
{
_ownerSetGracePeriod(_gracePeriod);
SEQUENCER_UPTIME_FEED = IChainlinkAggregator(_sequencerUptimeFeed);
}

Expand Down
24 changes: 12 additions & 12 deletions contracts_coverage/external/oracles/ChainlinkPriceOracleV1.sol
Expand Up @@ -77,20 +77,20 @@ contract ChainlinkPriceOracleV1 is IChainlinkPriceOracleV1, OnlyDolomiteMargin {
public
OnlyDolomiteMargin(_dolomiteMargin)
{
// coverage-disable-next-line
require(
_tokens.length == _chainlinkAggregators.length,
"Invalid aggregators"
if (_tokens.length == _chainlinkAggregators.length) { /* FOR COVERAGE TESTING */ }
Require.that(_tokens.length == _chainlinkAggregators.length,
FILE,
"Invalid tokens length"
);
// coverage-disable-next-line
require(
_chainlinkAggregators.length == _tokenDecimals.length,
"Invalid token decimals"
if (_chainlinkAggregators.length == _tokenDecimals.length) { /* FOR COVERAGE TESTING */ }
Require.that(_chainlinkAggregators.length == _tokenDecimals.length,
FILE,
"Invalid aggregators length"
);
// coverage-disable-next-line
require(
_tokenDecimals.length == _tokenPairs.length,
"Invalid token pairs"
if (_tokenDecimals.length == _tokenPairs.length) { /* FOR COVERAGE TESTING */ }
Require.that(_tokenDecimals.length == _tokenPairs.length,
FILE,
"Invalid decimals length"
);

uint256 tokensLength = _tokens.length;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -60,7 +60,7 @@
"deploy_coverage": "npm run replace_bytecode && RPC_NODE_URI=http://127.0.01:8545 npm run reset_test_evm && COVERAGE_REPLICA_DEPLOY=true node --max-old-space-size=16384 node_modules/.bin/truffle migrate --network coverage_replica && RPC_NODE_URI=http://127.0.0.1:8545 npm run snapshot_test_evm && npm run build:contract-artifacts",
"deploy_test_ci": "RPC_NODE_URI=http://0.0.0.0:8545 npm run reset_test_evm && npm run migrate -- --network test_ci --reset && RPC_NODE_URI=http://0.0.0.0:8545 npm run snapshot_test_evm && npm run check_amm_bytecode && npm run build:contract-artifacts",
"test_only": "NODE_ENV=test node --max-old-space-size=16384 node_modules/.bin/truffle test --network test",
"test_only_specific": "NODE_ENV=test node --max-old-space-size=16384 node_modules/.bin/truffle test --network test test/oracles/OracleSentinel.test.ts",
"test_only_specific": "NODE_ENV=test node --max-old-space-size=16384 node_modules/.bin/truffle test --network test test/oracles/ChainlinkPriceOracleV1.test.ts",
"ci_test": "NODE_ENV=test RPC_NODE_URI=http://0.0.0.0:8545 truffle test --network test",
"reset_test_evm": "node scripts/reset-test-evm.js",
"snapshot_test_evm": "node scripts/snapshot-test-evm.js",
Expand Down
1 change: 1 addition & 0 deletions test/Admin.test.ts
Expand Up @@ -1358,6 +1358,7 @@ describe('Admin', () => {
describe('#ownerSetOracleSentinel', () => {
async function deployChainlinkOracleSentinel(): Promise<OracleSentinel> {
const contract = await deployContract(dolomiteMargin, chainlinkOracleSentinelJson, [
INTEGERS.ONE_HOUR_IN_SECONDS.toFixed(),
dolomiteMargin.contracts.testSequencerUptimeFeedAggregator.options.address,
dolomiteMargin.address,
]);
Expand Down

0 comments on commit 6a8ae06

Please sign in to comment.