Skip to content

Commit

Permalink
Merge branch 'fartcoin-1.0'
Browse files Browse the repository at this point in the history
# Conflicts:
#	contrib/README.md
#	contrib/devtools/check-doc.py
#	contrib/devtools/clang-format-diff.py
#	contrib/devtools/gen-manpages.sh
#	contrib/devtools/security-check.py
#	contrib/gitian-descriptors/gitian-linux.yml
#	contrib/macdeploy/background.png
#	contrib/macdeploy/background.psd
#	contrib/macdeploy/background.svg
#	contrib/macdeploy/background.tiff
#	contrib/macdeploy/background@2x.png
#	contrib/macdeploy/custom_dsstore.py
#	contrib/macdeploy/macdeployqtplus
#	contrib/seeds/generate-seeds.py
#	contrib/seeds/nodes_main.txt
#	contrib/seeds/nodes_test.txt
#	src/chainparams.cpp
#	src/chainparamsseeds.h
#	src/clientversion.cpp
  • Loading branch information
Omar Iskandarani committed Aug 23, 2022
2 parents 84ae817 + 30829c6 commit a09d313
Show file tree
Hide file tree
Showing 212 changed files with 8,419 additions and 5,023 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,4 +1,5 @@
*.tar.gz
*.psd

*.exe
src/fartcoin
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
@@ -1,11 +1,11 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 1)
define(_CLIENT_VERSION_MINOR, 0)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_YEAR, 2022)
AC_INIT([Fartcoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/fartcoin-project/fartcoin/issues],[fartcoin])
AC_CONFIG_SRCDIR([src/main.cpp])
AC_CONFIG_HEADERS([src/config/bitcoin-config.h])
Expand Down
16 changes: 8 additions & 8 deletions contrib/README.md
Expand Up @@ -13,7 +13,7 @@ Construct a linear, no-fork, best version of the blockchain.

### [Qos](/contrib/qos) ###

A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Bitcoin network. This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it.
A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Fartcoin network. This means one can have an always-on fartcoind instance running, and another local fartcoind/fartcoin-qt instance which connects to this node and receives blocks from it.

### [Seeds](/contrib/seeds) ###
Utility to generate the pnSeed[] array that is compiled into the client.
Expand All @@ -22,20 +22,20 @@ Build Tools and Keys
---------------------

### [Debian](/contrib/debian) ###
Contains files used to package bitcoind/bitcoin-qt
for Debian-based Linux systems. If you compile bitcoind/bitcoin-qt yourself, there are some useful files here.
Contains files used to package fartcoind/fartcoin-qt
for Debian-based Linux systems. If you compile fartcoind/fartcoin-qt yourself, there are some useful files here.

### [Gitian-descriptors](/contrib/gitian-descriptors) ###
Notes on getting Gitian builds up and running using KVM.
Files used during the gitian build process. For more information about gitian, see the [the Bitcoin Core documentation repository](https://github.com/bitcoin-core/docs).

### [Gitian-keys](/contrib/gitian-keys)
PGP keys used for signing Bitcoin Core [Gitian release](/doc/release-process.md) results.
PGP keys used for signing Fartcoin Core [Gitian release](/doc/release-process.md) results.

### [MacDeploy](/contrib/macdeploy) ###
Scripts and notes for Mac builds.

### [RPM](/contrib/rpm) ###
RPM spec file for building bitcoin-core on RPM based distributions
RPM spec file for building bfartcoin-core on RPM based distributions.

### [Gitian-build](/contrib/gitian-build.sh) ###
Script for running full Gitian builds.
Expand All @@ -44,7 +44,7 @@ Test and Verify Tools
---------------------

### [TestGen](/contrib/testgen) ###
Utilities to generate test vectors for the data-driven Bitcoin tests.
Utilities to generate test vectors for the data-driven Fartcoin tests.

### [Verify Binaries](/contrib/verifybinaries) ###
This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org.
This script attempts to download and verify the signature file SHA256SUMS.asc from fartcoin.org.
45 changes: 45 additions & 0 deletions contrib/auto_gdb/README.md
@@ -0,0 +1,45 @@
# Contents
This directory contains tools to automatically get data about the memory consumption by some objects in fartcoind process with the help of GDB debugger.

## fartcoin_dbg.sh
This shell script attaches GDB to the running fartcoind process (should be built with debug info), executes debug.gdb script and detaches.
By default it uses testnet settings, see script comments to attach it to mainnet fartcoind.

## debug.gdb
Contains debugger instructions to execute during attach: loads python code and executes it for the objects we want to investigate.

## log_size.py
Contains definition of the gdb command log_size. After this script loads it can be called from gdb command line or other gdb scripts.
Command params:
`log_size arg0 arg1`
`arg0` - name of object whose memory will be written in log file
`arg1` - name of the log file
Example:
```
log_size mnodeman "memlog.txt"
```

## used_size.py
Contains definition of the gdb command used_size. After loading of this script it can be called from gdb command line or other gdb scripts.
Command params:
`used_size arg0 arg1`
`arg0` - variable to store memory used by the object
`arg1` - name of object whose memory will be calculated and stored in the first argument
Example:
```
>(gdb) set $size = 0
>(gdb) used_size $size mnodeman
>(gdb) p $size
```

## stl_containers.py
Contains helper classes to calculate memory used by the STL containers (list, vector, map, set, pair).

## simple_class_obj.py
Contains a helper class to calculate the memory used by an object as a sum of the memory used by its fields.
All processed objects of such type are listed in the this file, you can add new types you are interested in to this list.
If a type is not listed here, its size is the return of sizeof (except STL containers which are processed in stl_containers.py).

## common_helpers.py
Several helper functions that are used in other python code.

57 changes: 57 additions & 0 deletions contrib/auto_gdb/common_helpers.py
@@ -0,0 +1,57 @@
#!/usr/bin/python
#

try:
import gdb
except ImportError as e:
raise ImportError("This script must be run in GDB: ", str(e))
import sys
import os
sys.path.append(os.getcwd())
import stl_containers
import simple_class_obj

SIZE_OF_INT = 4
SIZE_OF_BOOL = 1
SIZE_OF_INT64 = 8
SIZE_OF_UINT256 = 32


def get_special_type_obj(gobj):
obj_type = gobj.type.strip_typedefs()
if stl_containers.VectorObj.is_this_type(obj_type):
return stl_containers.VectorObj(gobj)
if stl_containers.ListObj.is_this_type(obj_type):
return stl_containers.ListObj(gobj)
if stl_containers.PairObj.is_this_type(obj_type):
return stl_containers.PairObj(gobj)
if stl_containers.MapObj.is_this_type(obj_type):
return stl_containers.MapObj(gobj)
if stl_containers.SetObj.is_this_type(obj_type):
return stl_containers.SetObj(gobj)
if simple_class_obj.SimpleClassObj.is_this_type(obj_type):
return simple_class_obj.SimpleClassObj(gobj)
return False


def is_special_type(obj_type):
if stl_containers.VectorObj.is_this_type(obj_type):
return True
if stl_containers.ListObj.is_this_type(obj_type):
return True
if stl_containers.PairObj.is_this_type(obj_type):
return True
if stl_containers.MapObj.is_this_type(obj_type):
return True
if stl_containers.SetObj.is_this_type(obj_type):
return True
if simple_class_obj.SimpleClassObj.is_this_type(obj_type):
return True
return False


def get_instance_size(gobj):
obj = get_special_type_obj(gobj)
if not obj:
return gobj.type.sizeof
return obj.get_used_size()
12 changes: 12 additions & 0 deletions contrib/auto_gdb/debug.gdb
@@ -0,0 +1,12 @@
set pagination off
source used_size.py
source log_size.py
source test_used_size.gdb
#logsize privateSendClient "memlog.txt"
#logsize privateSendServer "memlog.txt"
#logsize mnodeman "memlog.txt"
logsize mnpayments "memlog.txt"
#logsize instantsend "memlog.txt"
#logsize sporkManager "memlog.txt"
#logsize masternodeSync "memlog.txt"
#logsize governance "memlog.txt"
4 changes: 4 additions & 0 deletions contrib/auto_gdb/fartcoin_dbg.sh
@@ -0,0 +1,4 @@
#!/bin/bash
# use testnet settings, if you need mainnet, use ~/.fartcoincore/fartcoind.pid file instead
fartcoin_pid=$(<~/.fartcoincore/testnet3/fartcoind.pid)
sudo gdb -batch -ex "source debug.gdb" fartcoind ${fartcoin_pid}
34 changes: 34 additions & 0 deletions contrib/auto_gdb/log_size.py
@@ -0,0 +1,34 @@
#!/usr/bin/python
#

try:
import gdb
except ImportError as e:
raise ImportError("This script must be run in GDB: ", str(e))
import traceback
import datetime
import sys
import os
sys.path.append(os.getcwd())
import common_helpers


class LogSizeCommand (gdb.Command):
"""calc size of the memory used by the object and write it to file"""

def __init__ (self):
super (LogSizeCommand, self).__init__ ("logsize", gdb.COMMAND_USER)

def invoke(self, arg, from_tty):
try:
args = gdb.string_to_argv(arg)
obj = gdb.parse_and_eval(args[0])
logfile = open(args[1], 'a')
size = common_helpers.get_instance_size(obj)
logfile.write("%s %s: %d\n" % (str(datetime.datetime.now()), args[0], size))
logfile.close()
except Exception as e:
print(traceback.format_exc())
raise e

LogSizeCommand()
58 changes: 58 additions & 0 deletions contrib/auto_gdb/simple_class_obj.py
@@ -0,0 +1,58 @@
#!/usr/bin/python
#

try:
import gdb
except ImportError as e:
raise ImportError("This script must be run in GDB: ", str(e))
import sys
import os
sys.path.append(os.getcwd())
import common_helpers


simple_types = ["CMasternode", "CMasternodeVerification",
"CMasternodeBroadcast", "CMasternodePing",
"CMasternodeMan", "CDarksendQueue", "CDarkSendEntry",
"CTransaction", "CMutableTransaction", "CPrivateSendBaseSession",
"CPrivateSendBaseManager", "CPrivateSendClientSession",
"CPrivateSendClientManager", "CPrivateSendServer", "CMasternodePayments",
"CMasternodePaymentVote", "CMasternodeBlockPayees",
"CMasternodePayee", "CInstantSend", "CTxLockRequest",
"CTxLockVote", "CTxLockCandidate", "COutPoint",
"COutPointLock", "CSporkManager", "CMasternodeSync",
"CGovernanceManager", "CRateCheckBuffer", "CGovernanceObject",
"CGovernanceVote", "CGovernanceObjectVoteFile"]

simple_templates = ["CacheMultiMap", "CacheMap"]


class SimpleClassObj:

def __init__ (self, gobj):
self.obj = gobj

@classmethod
def is_this_type(cls, obj_type):
str_type = str(obj_type)
if str_type in simple_types:
return True
for templ in simple_templates:
if str_type.find(templ + "<") == 0:
return True
return False

def get_used_size(self):
size = 0
fields = self.obj.type.fields()
for f in fields:
# check if it is static field
if not hasattr(f, "bitpos"):
continue
# process base class size
if f.is_base_class:
size += common_helpers.get_instance_size(self.obj.cast(f.type.strip_typedefs()))
continue
# process simple field
size += common_helpers.get_instance_size(self.obj[f.name])
return size

0 comments on commit a09d313

Please sign in to comment.