Skip to content

Commit

Permalink
Merge branch 'master' into change-opreturn-size
Browse files Browse the repository at this point in the history
  • Loading branch information
prasannavl authored Oct 27, 2022
2 parents 81f59a8 + 5983bd5 commit c18ccc5
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/dev-builds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
branches:
- master
- testnet
- epic/*
- t/*
- e/*
- v*
Expand All @@ -16,6 +17,7 @@ on:
branches:
- master
- testnet
- epic/*
- t/*
- e/*
- v*
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/jellyfish-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: Jellyfish Tests

on:
push:
branches: [ master ]
branches:
- master
- epic/*
pull_request:
branches: [ master ]
branches:
- master
- epic/*

jobs:
test:
Expand Down
1 change: 1 addition & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ void SetupServerArgs()
gArgs.AddArg("-greatworldheight", "Alias for Fort Canning Great World fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-fortcanningepilogueheight", "Alias for Fort Canning Epilogue fork activation height (regtest only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-jellyfish_regtest", "Configure the regtest network for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-regtest-skip-loan-collateral-validation", "Skip loan collateral check for jellyfish testing", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-simulatemainnet", "Configure the regtest network to mainnet target timespan and spacing ", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-dexstats", strprintf("Enable storing live dex data in DB (default: %u)", DEFAULT_DEXSTATS), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
#ifdef USE_UPNP
Expand Down
6 changes: 6 additions & 0 deletions src/masternodes/govvariables/attributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,12 @@ Res ATTRIBUTES::Apply(CCustomCSView & mnview, const uint32_t height)
}
} else if (attrV0->key == TokenKeys::LoanCollateralFactor) {
if (height >= static_cast<uint32_t>(Params().GetConsensus().FortCanningEpilogueHeight)) {
// Skip on if skip collateral check is passed
if (Params().NetworkIDString() == CBaseChainParams::REGTEST &&
gArgs.GetBoolArg("-regtest-skip-loan-collateral-validation", false)) {
continue;
}

std::set<CAmount> ratio;
mnview.ForEachLoanScheme([&ratio](const std::string &identifier, const CLoanSchemeData &data) {
ratio.insert(data.ratio);
Expand Down
49 changes: 49 additions & 0 deletions test/functional/feature_skip_collateral_factor_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env python3
# Copyright (c) 2014-2019 The Bitcoin Core developers
# Copyright (c) DeFi Blockchain Developers
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
"""Test - Skip Collateral Factor """

from test_framework.test_framework import DefiTestFramework


class SkipCollateralFactorTest (DefiTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
self.extra_args = [['-txnotokens=0', '-amkheight=1', '-bayfrontheight=1', '-bayfrontgardensheight=1', '-eunosheight=1', '-txindex=1', '-fortcanningheight=1', '-fortcanningroadheight=1',
'-fortcanninghillheight=1', '-fortcanningcrunchheight=1', '-fortcanninggreatworldheight=1', '-fortcanningepilogueheight=200', '-regtest-skip-loan-collateral-validation', '-jellyfish_regtest=1']]

def run_test(self):
# Generate chain
self.nodes[0].generate(120)

# Create loan tokens
self.symbolDUSD = "DUSD"
self.nodes[0].setloantoken({
'symbol': self.symbolDUSD,
'name': self.symbolDUSD,
'fixedIntervalPriceId': f"{self.symbolDUSD}/USD",
'mintable': True,
'interest': -1
})
self.nodes[0].generate(1)

# Store DUSD ID
self.idDUSD = list(self.nodes[0].gettoken(self.symbolDUSD).keys())[0]

# Move to fork
self.nodes[0].generate(200 - self.nodes[0].getblockcount())

# Create loan scheme
self.nodes[0].createloanscheme(150, 1, 'LOAN001')
self.nodes[0].generate(1)

# Should not throw error
self.nodes[0].setgov(
{"ATTRIBUTES": {f'v0/token/{self.idDUSD}/loan_collateral_factor': '1.50'}})


if __name__ == '__main__':
SkipCollateralFactorTest().main()
1 change: 1 addition & 0 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
'wallet_listsinceblock.py',
'p2p_leak.py',
'feature_higher_collateral_factor.py',
'feature_skip_collateral_factor_check.py',
'wallet_encryption.py',
'feature_dersig.py',
'feature_cltv.py',
Expand Down

0 comments on commit c18ccc5

Please sign in to comment.