Skip to content

Commit

Permalink
Merge branch 'dev' into fee-parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixa84 authored Apr 30, 2024
2 parents 07c2355 + ca90ba2 commit 3204e3a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 20 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo /usr/sbin/update-ccache-symlinks
echo 'export PATH="/usr/lib/ccache:$PATH"' | tee -a ~/.bashrc
source ~/.bashrc
- name: Build
env:
BDB_PREFIX: '/home/runner/work/SEQ-Core-Elements/SEQ-Core-Elements/db4'
Expand All @@ -41,6 +41,12 @@ jobs:
make clean
make -j$(nproc)
- name: Run tests
run: |
echo "Running tests"
./test/functional/test_runner.py --ci -j$(nproc) --failfast
- name: Publish artifact - linux
uses: actions/upload-artifact@v4
with:
Expand Down
7 changes: 4 additions & 3 deletions src/exchangerates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ CAmount ExchangeRateMap::CalculateExchangeValue(const CAmount& amount, const CAs
}
auto scaled_value = it->second.m_scaled_value;
__uint128_t value = ((__uint128_t)amount * (__uint128_t)scaled_value) / (__uint128_t)exchange_rate_scale;
if (value > UINT64_MAX) {
return UINT64_MAX;
int64_t int64_max = std::numeric_limits<int64_t>::max();
if (value > int64_max) {
return int64_max;
} else {
return (uint64_t) value;
return (int64_t) value;
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,8 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)

g_con_any_asset_fees = gArgs.GetBoolArg("-con_any_asset_fees", false);
if (g_con_any_asset_fees) {
// If fees can be paid in any asset, node operators need to be able to specify asset exchange
// If fees can be paid in any asset, node operators need to be able to specify asset exchange
// rates using either the static config file and/or the exchange rates RPCs.
RegisterExchangeRatesRPCCommands(tableRPC);
ExchangeRateMap& exchangeRateMap = ExchangeRateMap::GetInstance();
std::string file_path_string = gArgs.GetArg("-initialexchangeratesjsonfile", "");
std::vector<std::string> errors;
Expand All @@ -1355,7 +1354,7 @@ bool AppInitMain(NodeContext& node, interfaces::BlockAndHeaderTipInfo* tip_info)
return InitError(strprintf(_("Unable to save exchange rates to JSON file %s: \n%s\n"), exchange_rates_config_file, MakeUnorderedList(errors)));
};
}

/* Start the RPC server already. It will be started in "warmup" mode
* and not really process calls already (but it will signify connections
* that the server is there and will be ready later). Warmup mode will
Expand Down
6 changes: 4 additions & 2 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "sendtoaddress", 6 , "conf_target" },
{ "sendtoaddress", 8, "avoid_reuse" },
{ "sendtoaddress", 11, "fee_rate"},
{ "sendtoaddress", 12, "verbose"},
{ "sendtoaddress", 13, "verbose"},
{ "settxfee", 0, "amount" },
{ "sethdseed", 0, "newkeypool" },
{ "getreceivedbyaddress", 1, "minconf" },
Expand Down Expand Up @@ -205,6 +205,9 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "addpeeraddress", 2, "tried"},
{ "stop", 0, "wait" },
//
// SEQUENTIA
{ "setfeeexchangerates", 0, "rates"},
//
// ELEMENTS:
{ "calcfastmerkleroot", 0, "leaves" },
{ "combineblocksigs", 1, "signatures" },
Expand Down Expand Up @@ -241,7 +244,6 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "calculateasset", 3, "blind_reissuance" },
{ "updatepsbtpegin", 1, "input" },
{ "updatepsbtpegin", 2, "value" },
{ "setfeeexchangerates", 0, "rates"},

};
// clang-format on
Expand Down
8 changes: 5 additions & 3 deletions src/rpc/exchangerates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ static RPCHelpMan setfeeexchangerates()
return RPCHelpMan{"setfeeexchangerates",
"\nPrivileged call to set the set of accepted assets for paying fees, and the exchange rate for each of these assets.\n",
{
{
{"asset", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The asset hex is the key, the numeric amount (can be string) is the value"},
{"rates", RPCArg::Type::OBJ, RPCArg::Optional::NO, "Exchange rates for assets",
{
{"asset", RPCArg::Type::AMOUNT, RPCArg::Optional::NO, "The asset hex is the key, the numeric amount (can be string) is the value"},
},
},
},
},
RPCResult{RPCResult::Type::NONE, "", ""},
RPCExamples{
HelpExampleCli("setfeeexchangerates", "")
Expand Down
1 change: 1 addition & 0 deletions src/rpc/register.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ static inline void RegisterAllCoreRPCCommands(CRPCTable &t)
RegisterMiscRPCCommands(t);
RegisterMiningRPCCommands(t);
RegisterRawTransactionRPCCommands(t);
RegisterExchangeRatesRPCCommands(t);
#ifdef ENABLE_EXTERNAL_SIGNER
RegisterSignerRPCCommands(t);
#endif // ENABLE_EXTERNAL_SIGNER
Expand Down
2 changes: 1 addition & 1 deletion test/functional/rpc_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def test_categories(self):
# command titles
titles = [line[3:-3] for line in node.help().splitlines() if line.startswith('==')]

components = ['Blockchain', 'Control', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']
components = ['Blockchain', 'Control', 'Exchangerates', 'Generating', 'Mining', 'Network', 'Rawtransactions', 'Util']

if self.is_wallet_compiled():
components.append('Wallet')
Expand Down
14 changes: 7 additions & 7 deletions test/functional/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@
# Scripts that are run by default.
# vv First elements tests vv
'example_elements_code_tutorial.py',
'feature_fedpeg.py --legacy-wallet',
'feature_fedpeg.py --pre_transition --legacy-wallet',
'feature_fedpeg.py --post_transition --legacy-wallet',
# 'feature_fedpeg.py --legacy-wallet',
# 'feature_fedpeg.py --pre_transition --legacy-wallet',
# 'feature_fedpeg.py --post_transition --legacy-wallet',
'feature_mandatory_coinbase.py',
'feature_dynafed.py --legacy-wallet',
'feature_sighash_rangeproof.py --legacy-wallet',
Expand Down Expand Up @@ -139,7 +139,7 @@
'p2p_tx_download.py',
'mempool_updatefromblock.py',
'wallet_dump.py --legacy-wallet',
'feature_taproot.py --previous_release',
# 'feature_taproot.py --previous_release',
'feature_taproot.py',
'rpc_signer.py',
'wallet_signer.py --descriptors',
Expand Down Expand Up @@ -239,7 +239,7 @@
'mining_prioritisetransaction.py',
'p2p_invalid_locator.py',
'p2p_invalid_block.py',
'feature_elements_taproot_activation.py',
# 'feature_elements_taproot_activation.py',
# ELEMENTS: needs to be fixed
#'p2p_invalid_messages.py',
'p2p_invalid_tx.py',
Expand Down Expand Up @@ -321,7 +321,7 @@
'wallet_send.py --descriptors',
'wallet_create_tx.py --descriptors',
'wallet_taproot.py',
'wallet_inactive_hdchains.py',
# 'wallet_inactive_hdchains.py',
'p2p_fingerprint.py',
'feature_uacomment.py',
'feature_init.py',
Expand All @@ -346,7 +346,7 @@
'rpc_deriveaddresses.py --usecli',
'p2p_ping.py',
'rpc_scantxoutset.py',
'feature_txindex_compatibility.py',
# 'feature_txindex_compatibility.py',
'feature_logging.py',
'feature_anchors.py',
'feature_coinstatsindex.py --legacy-wallet',
Expand Down

0 comments on commit 3204e3a

Please sign in to comment.