Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e98f568
Give error if pow phase is finished
akshaynexus Jul 12, 2019
dc34049
Merge branch 'akshaynexus-fixpowrpc' into 'master'
akshaynexus Jul 13, 2019
c0b9359
Force Sync to allow for staking without mnsync
akshaynexus Sep 7, 2019
165852b
Merge branch 'akshaynexus-forcesyncx' into 'master'
2a5A1Ghu1 Sep 7, 2019
2e9058a
Fix error
akshaynexus Sep 7, 2019
decf6d2
Update rpcmisc.cpp
akshaynexus Sep 7, 2019
84159ba
Update rpcmisc.cpp
akshaynexus Sep 7, 2019
719d0ab
more ignore
2a5A1Ghu1 Sep 7, 2019
323b13f
Update fundamentalnode-sync.cpp
akshaynexus Sep 7, 2019
63e4aa9
Add gitian build python script
akshaynexus Sep 8, 2019
5be9a87
Update Univalue
akshaynexus Sep 8, 2019
8dbd204
add missing gencpp
akshaynexus Sep 8, 2019
2992efe
Add missing includes
akshaynexus Sep 8, 2019
229c717
Fix Gitian build
akshaynexus Sep 8, 2019
fab2a49
Merge branch 'master' of git.dev.vitae.co:blockchain/vitae
akshaynexus Sep 8, 2019
c1ec9b3
Revert "Update fundamentalnode-sync.cpp"
2a5A1Ghu1 Sep 8, 2019
a60925e
Merge branch 'revert-323b13fc' into 'master'
2a5A1Ghu1 Sep 8, 2019
aadd6c5
Fix gitian build and minor updates
akshaynexus Sep 8, 2019
6524268
Merge branch 'master' of git.dev.vitae.co:blockchain/vitae
akshaynexus Sep 8, 2019
c404117
remove forcesync
akshaynexus Sep 8, 2019
852db25
Merge branch 'master' into mine/master
akshaynexus Sep 8, 2019
23b9e46
Merge remote-tracking branch 'origin/master' into updates
akshaynexus Sep 8, 2019
d46db70
[Model] Invalid iterator position crash fix.
akshaynexus Oct 3, 2019
6cbfce3
background loading crash fixed.
akshaynexus Oct 3, 2019
5a52414
random: fix crash on some 64bit platforms
akshaynexus Oct 3, 2019
b46c1cb
random: Add fallback if getrandom syscall not available
akshaynexus Oct 3, 2019
e2a770e
Don't assert if we were beaten to the block
akshaynexus Oct 3, 2019
9998d8a
[Wallet] Add some LOCK to avoid crash
akshaynexus Oct 3, 2019
2e25699
testnet mining fixes
akshaynexus Oct 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,6 @@ libbitcoinconsensus.pc
CMakeLists.txt
cmake-build-debug

vitae-qt.pro
vitae-qt.pro
src/config/vitae-config.h
src/config/vitae-config.h.in
262 changes: 262 additions & 0 deletions contrib/gitian-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
#!/usr/bin/env python3

import argparse
import os
import subprocess
import sys

def setup():
global args, workdir
programs = ['ruby', 'git', 'make', 'wget', 'curl']
if args.kvm:
programs += ['apt-cacher-ng', 'python-vm-builder', 'qemu-kvm', 'qemu-utils']
elif args.docker and not os.path.isfile('/lib/systemd/system/docker.service'):
dockers = ['docker.io', 'docker-ce']
for i in dockers:
return_code = subprocess.call(['sudo', 'apt-get', 'install', '-qq', i])
if return_code == 0:
break
if return_code != 0:
print('Cannot find any way to install Docker.', file=sys.stderr)
sys.exit(1)
else:
programs += ['apt-cacher-ng', 'lxc', 'debootstrap']
subprocess.check_call(['sudo', 'apt-get', 'install', '-qq'] + programs)
if not os.path.isdir('gitian.sigs'):
subprocess.check_call(['git', 'clone', 'https://github.com/pivx-Project/gitian.sigs.git'])
if not os.path.isdir('pivx-detached-sigs'):
subprocess.check_call(['git', 'clone', 'https://github.com/pivx-Project/pivx-detached-sigs.git'])
if not os.path.isdir('gitian-builder'):
subprocess.check_call(['git', 'clone', 'https://github.com/devrandom/gitian-builder.git'])
if not os.path.isdir('vitae'):
subprocess.check_call(['git', 'clone', 'https://github.com/VitaeTeam/Vitae.git'])
os.chdir('gitian-builder')
make_image_prog = ['bin/make-base-vm', '--suite', 'bionic', '--arch', 'amd64']
if args.docker:
make_image_prog += ['--docker']
elif not args.kvm:
make_image_prog += ['--lxc']
subprocess.check_call(make_image_prog)
os.chdir(workdir)
if args.is_bionic and not args.kvm and not args.docker:
subprocess.check_call(['sudo', 'sed', '-i', 's/lxcbr0/br0/', '/etc/default/lxc-net'])
print('Reboot is required')
sys.exit(0)

def build():
global args, workdir

os.makedirs('vitae-binaries/' + args.version, exist_ok=True)
print('\nBuilding Dependencies\n')
os.chdir('gitian-builder')
os.makedirs('inputs', exist_ok=True)

subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz'])
subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch'])
subprocess.check_call(["echo 'a8c4e9cafba922f89de0df1f2152e7be286aba73f78505169bc351a7938dd911 inputs/osslsigncode-Backports-to-1.7.1.patch' | sha256sum -c"], shell=True)
subprocess.check_call(["echo 'f9a8cdb38b9c309326764ebc937cba1523a3a751a7ab05df3ecc99d18ae466c9 inputs/osslsigncode-1.7.1.tar.gz' | sha256sum -c"], shell=True)
subprocess.check_call(['make', '-C', '../vitae/depends', 'download', 'SOURCES_PATH=' + os.getcwd() + '/cache/common'])

if args.linux:
print('\nCompiling ' + args.version + ' Linux')
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-linux.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-linux', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-linux.yml'])
subprocess.check_call('mv build/out/vitae-*.tar.gz build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True)

if args.windows:
print('\nCompiling ' + args.version + ' Windows')
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-win.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-unsigned', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-win.yml'])
subprocess.check_call('mv build/out/vitae-*-win-unsigned.tar.gz inputs/', shell=True)
subprocess.check_call('mv build/out/vitae-*.zip build/out/vitae-*.exe build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True)

if args.macos:
print('\nCompiling ' + args.version + ' MacOS')
subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'vitae='+args.commit, '--url', 'vitae='+args.url, '../vitae/contrib/gitian-descriptors/gitian-osx.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-unsigned', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-osx.yml'])
subprocess.check_call('mv build/out/vitae-*-osx-unsigned.tar.gz inputs/', shell=True)
subprocess.check_call('mv build/out/vitae-*.tar.gz build/out/vitae-*.dmg build/out/src/vitae-*.tar.gz ../vitae-binaries/'+args.version, shell=True)

os.chdir(workdir)

if args.commit_files:
print('\nCommitting '+args.version+' Unsigned Sigs\n')
os.chdir('gitian.sigs')
subprocess.check_call(['git', 'add', args.version+'-linux/'+args.signer])
subprocess.check_call(['git', 'add', args.version+'-win-unsigned/'+args.signer])
subprocess.check_call(['git', 'add', args.version+'-osx-unsigned/'+args.signer])
subprocess.check_call(['git', 'commit', '-m', 'Add '+args.version+' unsigned sigs for '+args.signer])
os.chdir(workdir)

def sign():
global args, workdir
os.chdir('gitian-builder')

if args.windows:
print('\nSigning ' + args.version + ' Windows')
subprocess.check_call('cp inputs/vitae-' + args.version + '-win-unsigned.tar.gz inputs/vitae-win-unsigned.tar.gz', shell=True)
subprocess.check_call(['bin/gbuild', '--skip-image', '--upgrade', '--commit', 'signature='+args.commit, '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-win-signed', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml'])
subprocess.check_call('mv build/out/vitae-*win64-setup.exe ../vitae-binaries/'+args.version, shell=True)
subprocess.check_call('mv build/out/vitae-*win32-setup.exe ../vitae-binaries/'+args.version, shell=True)

if args.macos:
print('\nSigning ' + args.version + ' MacOS')
subprocess.check_call('cp inputs/vitae-' + args.version + '-osx-unsigned.tar.gz inputs/vitae-osx-unsigned.tar.gz', shell=True)
subprocess.check_call(['bin/gbuild', '--skip-image', '--upgrade', '--commit', 'signature='+args.commit, '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml'])
subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-signed', '--destination', '../gitian.sigs/', '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml'])
subprocess.check_call('mv build/out/vitae-osx-signed.dmg ../vitae-binaries/'+args.version+'/vitae-'+args.version+'-osx.dmg', shell=True)

os.chdir(workdir)

if args.commit_files:
print('\nCommitting '+args.version+' Signed Sigs\n')
os.chdir('gitian.sigs')
subprocess.check_call(['git', 'add', args.version+'-win-signed/'+args.signer])
subprocess.check_call(['git', 'add', args.version+'-osx-signed/'+args.signer])
subprocess.check_call(['git', 'commit', '-a', '-m', 'Add '+args.version+' signed binary sigs for '+args.signer])
os.chdir(workdir)

def verify():
global args, workdir
rc = 0
os.chdir('gitian-builder')

print('\nVerifying v'+args.version+' Linux\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-linux', '../vitae/contrib/gitian-descriptors/gitian-linux.yml']):
print('Verifying v'+args.version+' Linux FAILED\n')
rc = 1

print('\nVerifying v'+args.version+' Windows\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-unsigned', '../vitae/contrib/gitian-descriptors/gitian-win.yml']):
print('Verifying v'+args.version+' Windows FAILED\n')
rc = 1

print('\nVerifying v'+args.version+' MacOS\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-signed', '../vitae/contrib/gitian-descriptors/gitian-osx.yml']):
print('Verifying v'+args.version+' MacOS FAILED\n')
rc = 1

print('\nVerifying v'+args.version+' Signed Windows\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-win-signed', '../vitae/contrib/gitian-descriptors/gitian-win-signer.yml']):
print('Verifying v'+args.version+' Signed Windows FAILED\n')
rc = 1

print('\nVerifying v'+args.version+' Signed MacOS\n')
if subprocess.call(['bin/gverify', '-v', '-d', '../gitian.sigs/', '-r', args.version+'-osx-signed', '../vitae/contrib/gitian-descriptors/gitian-osx-signer.yml']):
print('Verifying v'+args.version+' Signed MacOS FAILED\n')
rc = 1

os.chdir(workdir)
return rc

def main():
global args, workdir

parser = argparse.ArgumentParser(description='Script for running full Gitian builds.')
parser.add_argument('-c', '--commit', action='store_true', dest='commit', help='Indicate that the version argument is for a commit or branch')
parser.add_argument('-p', '--pull', action='store_true', dest='pull', help='Indicate that the version argument is the number of a github repository pull request')
parser.add_argument('-u', '--url', dest='url', default='https://github.com/VitaeTeam/Vitae', help='Specify the URL of the repository. Default is %(default)s')
parser.add_argument('-v', '--verify', action='store_true', dest='verify', help='Verify the Gitian build')
parser.add_argument('-b', '--build', action='store_true', dest='build', help='Do a Gitian build')
parser.add_argument('-s', '--sign', action='store_true', dest='sign', help='Make signed binaries for Windows and MacOS')
parser.add_argument('-B', '--buildsign', action='store_true', dest='buildsign', help='Build both signed and unsigned binaries')
parser.add_argument('-o', '--os', dest='os', default='lwm', help='Specify which Operating Systems the build is for. Default is %(default)s. l for Linux, w for Windows, m for MacOS')
parser.add_argument('-j', '--jobs', dest='jobs', default='2', help='Number of processes to use. Default %(default)s')
parser.add_argument('-m', '--memory', dest='memory', default='2000', help='Memory to allocate in MiB. Default %(default)s')
parser.add_argument('-k', '--kvm', action='store_true', dest='kvm', help='Use KVM instead of LXC')
parser.add_argument('-d', '--docker', action='store_true', dest='docker', help='Use Docker instead of LXC')
parser.add_argument('-S', '--setup', action='store_true', dest='setup', help='Set up the Gitian building environment. Only works on Debian-based systems (Ubuntu, Debian)')
parser.add_argument('-D', '--detach-sign', action='store_true', dest='detach_sign', help='Create the assert file for detached signing. Will not commit anything.')
parser.add_argument('-n', '--no-commit', action='store_false', dest='commit_files', help='Do not commit anything to git')
parser.add_argument('signer', nargs='?', help='GPG signer to sign each build assert file')
parser.add_argument('version', nargs='?', help='Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified')

args = parser.parse_args()
workdir = os.getcwd()

args.is_bionic = b'bionic' in subprocess.check_output(['lsb_release', '-cs'])

if args.kvm and args.docker:
raise Exception('Error: cannot have both kvm and docker')

# Ensure no more than one environment variable for gitian-builder (USE_LXC, USE_VBOX, USE_DOCKER) is set as they
# can interfere (e.g., USE_LXC being set shadows USE_DOCKER; for details see gitian-builder/libexec/make-clean-vm).
os.environ['USE_LXC'] = ''
os.environ['USE_VBOX'] = ''
os.environ['USE_DOCKER'] = ''
if args.docker:
os.environ['USE_DOCKER'] = '1'
elif not args.kvm:
os.environ['USE_LXC'] = '1'
if 'GITIAN_HOST_IP' not in os.environ.keys():
os.environ['GITIAN_HOST_IP'] = '10.0.3.1'
if 'LXC_GUEST_IP' not in os.environ.keys():
os.environ['LXC_GUEST_IP'] = '10.0.3.5'

if args.setup:
setup()

if args.buildsign:
args.build = True
args.sign = True

if not args.build and not args.sign and not args.verify:
sys.exit(0)

args.linux = 'l' in args.os
args.windows = 'w' in args.os
args.macos = 'm' in args.os

# Disable for MacOS if no SDK found
if args.macos and not os.path.isfile('gitian-builder/inputs/MacOSX10.11.sdk.tar.gz'):
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
args.macos = False

args.sign_prog = 'true' if args.detach_sign else 'gpg --detach-sign'

script_name = os.path.basename(sys.argv[0])
if not args.signer:
print(script_name+': Missing signer')
print('Try '+script_name+' --help for more information')
sys.exit(1)
if not args.version:
print(script_name+': Missing version')
print('Try '+script_name+' --help for more information')
sys.exit(1)

# Add leading 'v' for tags
if args.commit and args.pull:
raise Exception('Cannot have both commit and pull')
args.commit = ('' if args.commit else 'v') + args.version

os.chdir('vitae')
if args.pull:
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
os.chdir('../gitian-builder/inputs/vitae')
subprocess.check_call(['git', 'fetch', args.url, 'refs/pull/'+args.version+'/merge'])
args.commit = subprocess.check_output(['git', 'show', '-s', '--format=%H', 'FETCH_HEAD'], universal_newlines=True, encoding='utf8').strip()
args.version = 'pull-' + args.version
print(args.commit)
subprocess.check_call(['git', 'fetch'])
subprocess.check_call(['git', 'checkout', args.commit])
os.chdir(workdir)

os.chdir('gitian-builder')
subprocess.check_call(['git', 'pull'])
os.chdir(workdir)

if args.build:
build()

if args.sign:
sign()

if args.verify:
os.chdir('gitian.sigs')
subprocess.check_call(['git', 'pull'])
os.chdir(workdir)
sys.exit(verify())

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Threads

- ThreadRPCServer : Remote procedure call handler, listens on port 8332 for connections and services them.

- BitcoinMiner : Generates bitcoins (if wallet is enabled).
- VitaeMiner : Generates bitcoins (if wallet is enabled).

- Shutdown : Does an orderly shutdown of everything.

Expand Down
Empty file modified qa/rpc-tests/python-bitcoinrpc/bitcoinrpc/__init__.py
100755 → 100644
Empty file.
4 changes: 4 additions & 0 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ BITCOIN_CORE_H = \
limitedmap.h \
main.h \
masternode.h \
masternode-sync.h \
masternode-payments.h \
masternode-budget.h \
masternodeman.h \
masternode-pos.h \
masternodeman.h \
masternodeconfig.h \
Expand Down
Loading