Skip to content

Commit

Permalink
Optimization of the warning messages adding function
Browse files Browse the repository at this point in the history
  • Loading branch information
levoncrypto committed Jun 12, 2024
2 parents 4fc081a + ba702ec commit 352a098
Show file tree
Hide file tree
Showing 34 changed files with 228 additions and 661 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
- name: Use Xcode instead of Command Line Tools
run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
- name: Install Required Packages
run: brew install automake coreutils pkg-config
run: brew install automake coreutils pkg-config python-setuptools
# Workaround for macOS: https://github.com/actions/runner/issues/2958
- name: Install setuptools
run: sudo -H pip install setuptools
Expand All @@ -181,7 +181,7 @@ jobs:
working-directory: ${{ env.SOURCE_ARTIFACT }}
- name: Build Firo
run: |
./configure --disable-jni --prefix=$(grealpath depends/x86_64-apple-darwin*)
./configure --prefix=`pwd`/depends/`depends/config.guess`
make -j$(sysctl -n hw.activecpu)
working-directory: ${{ env.SOURCE_ARTIFACT }}
- name: Prepare Files for Artifact
Expand Down
6 changes: 1 addition & 5 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ QT_FORMS_UI = \
qt/forms/sendtopcodedialog.ui \
qt/forms/signverifymessagedialog.ui \
qt/forms/transactiondescdialog.ui \
qt/forms/lelantusdialog.ui \
qt/forms/createpcodedialog.ui
qt/forms/lelantusdialog.ui

QT_MOC_CPP = \
qt/moc_addressbookpage.cpp \
Expand All @@ -139,7 +138,6 @@ QT_MOC_CPP = \
qt/moc_manualmintdialog.cpp \
qt/moc_coincontroltreewidget.cpp \
qt/moc_csvmodelwriter.cpp \
qt/moc_createpcodedialog.cpp \
qt/moc_editaddressdialog.cpp \
qt/moc_guiutil.cpp \
qt/moc_intro.cpp \
Expand Down Expand Up @@ -215,7 +213,6 @@ BITCOIN_QT_H = \
qt/cancelpassworddialog.h \
qt/clientmodel.h \
qt/coincontroldialog.h \
qt/createpcodedialog.h \
qt/manualmintdialog.h \
qt/coincontroltreewidget.h \
qt/csvmodelwriter.h \
Expand Down Expand Up @@ -429,7 +426,6 @@ BITCOIN_QT_WALLET_CPP = \
qt/askpassphrasedialog.cpp \
qt/coincontroldialog.cpp \
qt/coincontroltreewidget.cpp \
qt/createpcodedialog.cpp \
qt/editaddressdialog.cpp \
qt/manualmintdialog.cpp \
qt/openuridialog.cpp \
Expand Down
2 changes: 1 addition & 1 deletion src/crypto/MerkleTreeProof/argon2.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ extern "C" {
#define ARGON2_FLAG_CLEAR_SECRET (UINT32_C(1) << 1)

/* Global flag to determine if we are wiping internal memory buffers. This flag
* is defined in core.c and deafults to 1 (wipe internal memory). */
* is defined in core.c and defaults to 1 (wipe internal memory). */
extern int FLAG_clear_internal_memory;

/* Error codes */
Expand Down
2 changes: 1 addition & 1 deletion src/ctpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace ctpl {


// wait for all computing threads to finish and stop all threads
// may be called asyncronously to not pause the calling thread while waiting
// may be called asynchronously to not pause the calling thread while waiting
// if isWait == true, all the functions in the queue are run, otherwise the queue is cleared without running the functions
void stop(bool isWait = false) {
if (!isWait) {
Expand Down
2 changes: 1 addition & 1 deletion src/fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ namespace detail {


// lets us do things like "typedef numeric::fixed_from_type<int32_t>::fixed_type fixed";
// NOTE: that we will use a type of equivalent size, not neccessarily the type
// NOTE: that we will use a type of equivalent size, not necessarily the type
// specified. Should make little to no difference to the user
template <class T>
struct fixed_from_type {
Expand Down
2 changes: 1 addition & 1 deletion src/fuzz/FuzzedDataProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ FuzzedDataProvider::ConsumeRandomLengthString(size_t max_length) {
// picking its contents.
std::string result;

// Reserve the anticipated capaticity to prevent several reallocations.
// Reserve the anticipated capacity to prevent several reallocations.
result.reserve(std::min(max_length, remaining_bytes_));
for (size_t i = 0; i < max_length && remaining_bytes_ != 0; ++i) {
char next = ConvertUnsignedToSigned<char>(data_ptr_[0]);
Expand Down
4 changes: 2 additions & 2 deletions src/fuzz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ example:
2. `honggfuzz -i ../input -- ./../libspark/bpplus_hfuzz ___FILE___`
3. To stop press `ctrl+c`

Here we are providing an empty corpora. In case of an already available corpora, we can provide the availabe corpora.
Here we are providing an empty corpora. In case of an already available corpora, we can provide the available corpora.
The flag `-i` is for the input folder which we are providing `./../<filename>_hfuzz>` is the target binary which we want to fuzz.

### Analyzing the crashes
Expand Down Expand Up @@ -129,7 +129,7 @@ sudo make install
Once successfully installed, follow the below instructions to generate the code-coverage

1. First compile the harness with gdb flag. run `make <filename>_debug` inside src/fuzz to compile using gdb debugger.
2. take the input_folder as the input corpora from fuzzing or one can also create it by running: `honggfuzz -i <input_folder> -– ./<filename>_hfuzz ___FILE___ @@`. This will start the fuzzer. Kill it by `ctrl+C`. The fuzzer will generate some random inputs inside the input_folder. Since kcov will generate coverage for each input inside the input_folder, it's preffered to have only a few inputs, otherwise it will take a long time to generate the entire coverage.
2. take the input_folder as the input corpora from fuzzing or one can also create it by running: `honggfuzz -i <input_folder> -– ./<filename>_hfuzz ___FILE___ @@`. This will start the fuzzer. Kill it by `ctrl+C`. The fuzzer will generate some random inputs inside the input_folder. Since kcov will generate coverage for each input inside the input_folder, it's preferred to have only a few inputs, otherwise it will take a long time to generate the entire coverage.

3. inside the `generate_coverage.sh` replace the input_folder, output_folder and fuzz_exe by your inpur corpora, coverage output folder and harness binary.
4. run `./generate_coverage.sh`. This will generated a merged output for all the inputs present in the input_folder.
Expand Down
2 changes: 1 addition & 1 deletion src/hdmint/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ CKeyID CHDMintWallet::GetMintSeedID(CWalletDB& walletdb, int32_t nCount){
* @param mintSeed
* @param nCount (optional) count in the HD Chain of the key to use for mint generation.
* @param seedId (optional) seedId of the key to use for mint generation.
* @return sucess
* @return success
*/
bool CHDMintWallet::CreateMintSeed(CWalletDB& walletdb, uint512& mintSeed, const int32_t& nCount, CKeyID& seedId, bool fWriteChain)
{
Expand Down
31 changes: 1 addition & 30 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
showHelpMessageAction(0),
lelantusAction(0),
masternodeAction(0),
createPcodeAction(0),
logoAction(0),
trayIcon(0),
trayIconMenu(0),
Expand Down Expand Up @@ -366,13 +365,6 @@ void BitcoinGUI::createActions()
tabGroup->addAction(masternodeAction);
#endif

createPcodeAction = new QAction(tr("RA&P addresses"), this);
createPcodeAction->setStatusTip(tr("Create RAP addresses (BIP47 payment codes)"));
createPcodeAction->setToolTip(createPcodeAction->statusTip());
createPcodeAction->setCheckable(true);
createPcodeAction->setShortcut(QKeySequence(Qt::ALT + key++));
tabGroup->addAction(createPcodeAction);

#ifdef ENABLE_WALLET
connect(masternodeAction, &QAction::triggered, [this]{ showNormalIfMinimized(); });
connect(masternodeAction, &QAction::triggered, this, &BitcoinGUI::gotoMasternodePage);
Expand All @@ -390,7 +382,6 @@ void BitcoinGUI::createActions()
connect(historyAction, &QAction::triggered, this, &BitcoinGUI::gotoHistoryPage);

connect(lelantusAction, &QAction::triggered, this, &BitcoinGUI::gotoLelantusPage);
connect(createPcodeAction, &QAction::triggered, this, &BitcoinGUI::gotoCreatePcodePage);
#endif // ENABLE_WALLET

quitAction = new QAction(tr("E&xit"), this);
Expand Down Expand Up @@ -531,8 +522,7 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(historyAction);
toolbar->addAction(lelantusAction);
toolbar->addAction(masternodeAction);
toolbar->addAction(createPcodeAction);


QLabel *logoLabel = new QLabel();
logoLabel->setObjectName("lblToolbarLogo");
logoLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
Expand Down Expand Up @@ -593,10 +583,6 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
// update lelantus page if option is changed.
connect(optionsModel, &OptionsModel::lelantusPageChanged, this, &BitcoinGUI::updateLelantusPage);

// update RAP Addresses page if option is changed.
connect(optionsModel, &OptionsModel::enableRapAddressesChanged, this, &BitcoinGUI::setRapAddressesVisible);
createPcodeAction->setVisible(optionsModel->getRapAddresses());

// initialize the disable state of the tray icon with the current value in the model.
setTrayIconVisible(optionsModel->getHideTrayIcon());
}
Expand Down Expand Up @@ -659,7 +645,6 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled)
sendCoinsMenuAction->setEnabled(enabled);
receiveCoinsAction->setEnabled(enabled);
receiveCoinsMenuAction->setEnabled(enabled);
createPcodeAction->setEnabled(enabled);
historyAction->setEnabled(enabled);
lelantusAction->setEnabled(enabled);
masternodeAction->setEnabled(enabled);
Expand Down Expand Up @@ -811,12 +796,6 @@ void BitcoinGUI::gotoReceiveCoinsPage()
if (walletFrame) walletFrame->gotoReceiveCoinsPage();
}

void BitcoinGUI::gotoCreatePcodePage()
{
createPcodeAction->setChecked(true);
if (walletFrame) walletFrame->gotoCreatePcodePage();
}

void BitcoinGUI::gotoSendCoinsPage(QString addr)
{
sendCoinsAction->setChecked(true);
Expand Down Expand Up @@ -1350,14 +1329,6 @@ void BitcoinGUI::updateLelantusPage()
checkLelantusVisibility(blocks);
}

void BitcoinGUI::setRapAddressesVisible(bool checked)
{
#ifdef ENABLE_WALLET
gotoOverviewPage();
#endif // ENABLE_WALLET
createPcodeAction->setVisible(checked);
}

static bool ThreadSafeMessageBox(BitcoinGUI *gui, const std::string& message, const std::string& caption, unsigned int style)
{
bool modal = (style & CClientUIInterface::MODAL);
Expand Down
5 changes: 0 additions & 5 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ class BitcoinGUI : public QMainWindow
QAction *showHelpMessageAction;
QAction *lelantusAction;
QAction *masternodeAction;
QAction *createPcodeAction;
QAction *logoAction;

QSystemTrayIcon *trayIcon;
Expand Down Expand Up @@ -218,8 +217,6 @@ public Q_SLOTS:
void gotoMasternodePage();
/** Switch to receive coins page */
void gotoReceiveCoinsPage();
/** Switch to create payment code page */
void gotoCreatePcodePage();
/** Switch to send coins page */
void gotoSendCoinsPage(QString addr = "");
/** Switch to lelantus page */
Expand Down Expand Up @@ -275,8 +272,6 @@ public Q_SLOTS:
/** Update Lelantus page visibility */
void updateLelantusPage();

/** Update RAP Addresses page visibility */
void setRapAddressesVisible(bool);
};

class UnitDisplayStatusBarControl : public QLabel
Expand Down
2 changes: 1 addition & 1 deletion src/qt/bitcoinstrings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ QT_TRANSLATE_NOOP("firo-core", "Transaction has too long of a mempool chain"),
QT_TRANSLATE_NOOP("firo-core", "Transaction must have at least one recipient"),
QT_TRANSLATE_NOOP("firo-core", "Transaction not valid."),
QT_TRANSLATE_NOOP("firo-core", "Transaction too large for fee policy"),
QT_TRANSLATE_NOOP("firo-core", "Transaction too large"),
QT_TRANSLATE_NOOP("firo-core", "Transaction is too large (size limit: 100Kb). Select less inputs or consolidate your UTXOs"),
QT_TRANSLATE_NOOP("firo-core", "Trying to spend an already spent serial #, try again."),
QT_TRANSLATE_NOOP("firo-core", "Unable to bind to %s on this computer (bind returned error %s)"),
QT_TRANSLATE_NOOP("firo-core", "Unable to bind to %s on this computer. %s is probably already running."),
Expand Down
6 changes: 3 additions & 3 deletions src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,9 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog, bool a
{
if (anonymousMode) {
if(spark::IsSparkAllowed()) {
// 924 is constant part, mainly Schnorr and Range proofs, 2535 is for each grootle proof/aux data
// 213 for each private output, 144 other parts of tx,
nBytes = 924 + 2535 * (vOutputs.size()) + 213 * CoinControlDialog::payAmounts.size() + 144;
// 924 is constant part, mainly Schnorr and Range proofs, 1803 is for each grootle proof/aux data
// 213 for each private output,
nBytes = 924 + 1803 * (vOutputs.size()) + 322 * CoinControlDialog::payAmounts.size();
} else {
// 1054 is constant part, mainly Schnorr and Range proofs, 2560 is for each sigma/aux data
// 83 assuming 1 jmint, 34 is the size of each normal vout, 10 is the size of empty transaction, 52 other constant parts
Expand Down
Loading

0 comments on commit 352a098

Please sign in to comment.