Integrate GH super linter - fix shell, markdown, python issues (#296)

* Try super-linter
* Fix lint issues, move to separate gh action
* Fix md, shell
* Ignore import-error for python - fix MDs
* Disable standard-js, initial eslint config
* Fix raises, remove prettier for now
* skip pylint no-member check in src/util/byte_types.py line 40
* pyinstaller windows back to INFO
* Disable powershell lint for now.
* Disable css validation temporarily
This commit is contained in:
Gene Hoffman 2020-06-23 20:47:06 -07:00
parent 562d8a1cfb
commit c3a3fdba1f
22 changed files with 799 additions and 57 deletions

41
.github/linters/.eslintrc.yml vendored Normal file
View File

@ -0,0 +1,41 @@
---
#############################
#############################
## JavaScript Linter rules ##
#############################
#############################
############
# Env Vars #
############
env:
browser: true
es6: true
jest: true
###############
# Global Vars #
###############
globals:
Atomics: readonly
SharedArrayBuffer: readonly
###############
# Parser vars #
###############
parser: '@typescript-eslint/parser'
parserOptions:
ecmaVersion: 2018
sourceType: module
###########
# Plugins #
###########
plugins:
- '@typescript-eslint'
#########
# Rules #
#########
rules: {}

37
.github/linters/.markdown-lint.yml vendored Normal file
View File

@ -0,0 +1,37 @@
---
###########################
###########################
## Markdown Linter rules ##
###########################
###########################
# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#
###############
# Rules by id #
###############
MD004: false # Unordered list style
MD007:
indent: 2 # Unordered list indentation
MD013:
line_length: 808 # Line length
MD024:
allow_different_nesting: true
MD026:
punctuation: ".,;:!。,;:" # List of not allowed
MD029: false # Ordered list item prefix
MD033: false # Allow inline HTML
MD036: false # Emphasis used instead of a heading
#################
# Rules by tags #
#################
blank_lines: false # Error on blank lines

View File

@ -0,0 +1,18 @@
#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/markdown/Invoke-ScriptAnalyzer.md#-settings
@{
#CustomRulePath='path\to\CustomRuleModule.psm1'
#RecurseCustomRulePath='path\of\customrules'
#Severity = @(
# 'Error'
# 'Warning'
#)
#IncludeDefaultRules=$true
#ExcludeRules = @(
# 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName'
#)
#IncludeRules = @(
# 'PSAvoidUsingWriteHost',
# 'MyCustomRuleName'
#)
}

565
.github/linters/.python-lint vendored Normal file
View File

@ -0,0 +1,565 @@
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=
# Add files or directories to the blacklist. They should be base names, not
# paths.
ignore=
# Add files or directories matching the regex patterns to the blacklist. The
# regex matches against base names, not paths.
ignore-patterns=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Use multiple processes to speed up Pylint.
jobs=1
# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
# Pickle collected data for later comparisons.
persistent=yes
# Specify a configuration file.
#rcfile=
# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages
suggestion-mode=yes
# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
[MESSAGES CONTROL]
# Only show warnings with the listed confidence levels. Leave empty to show
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
confidence=
# Disable the message, report, category or checker with the given id(s). You
# can either give multiple identifiers separated by comma (,) or put this
# option multiple times (only on the command line, not in the configuration
# file where it should appear only once).You can also use "--disable=all" to
# disable everything first and then reenable specific checks. For example, if
# you want to run only the similarities checker, you can use "--disable=all
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=print-statement,
parameter-unpacking,
unpacking-in-except,
old-raise-syntax,
backtick,
long-suffix,
old-ne-operator,
old-octal-literal,
import-star-module-level,
non-ascii-bytes-literal,
raw-checker-failed,
bad-inline-option,
locally-disabled,
locally-enabled,
file-ignored,
suppressed-message,
useless-suppression,
deprecated-pragma,
apply-builtin,
basestring-builtin,
buffer-builtin,
cmp-builtin,
coerce-builtin,
execfile-builtin,
file-builtin,
long-builtin,
raw_input-builtin,
reduce-builtin,
standarderror-builtin,
unicode-builtin,
xrange-builtin,
coerce-method,
delslice-method,
getslice-method,
setslice-method,
no-absolute-import,
old-division,
dict-iter-method,
dict-view-method,
next-method-called,
metaclass-assignment,
indexing-exception,
raising-string,
reload-builtin,
oct-method,
hex-method,
nonzero-method,
cmp-method,
input-builtin,
round-builtin,
intern-builtin,
unichr-builtin,
map-builtin-not-iterating,
zip-builtin-not-iterating,
range-builtin-not-iterating,
filter-builtin-not-iterating,
using-cmp-argument,
eq-without-hash,
div-method,
idiv-method,
rdiv-method,
exception-message-attribute,
invalid-str-codec,
sys-max-int,
bad-python3-import,
deprecated-string-function,
deprecated-str-translate-call,
deprecated-itertools-function,
deprecated-types-field,
next-method-defined,
dict-items-not-iterating,
dict-keys-not-iterating,
dict-values-not-iterating,
import-error
# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
# multiple time (only on the command line, not in the configuration file where
# it should appear only once). See also the "--disable" option for examples.
enable=c-extension-no-member
[REPORTS]
# Python expression which should return a note less than 10 (10 is the highest
# note). You have access to the variables errors warning, statement which
# respectively contain the number of errors / warnings messages and the total
# number of statements analyzed. This is used by the global evaluation report
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Template used to display messages. This is a python new-style format string
# used to format the message information. See doc for all details
#msg-template=
# Set the output format. Available formats are text, parseable, colorized, json
# and msvs (visual studio).You can also give a reporter class, eg
# mypackage.mymodule.MyReporterClass.
output-format=text
# Tells whether to display a full report or only the messages
reports=no
# Activate the evaluation score.
score=yes
[REFACTORING]
# Maximum number of nested blocks for function / method body
max-nested-blocks=5
# Complete name of functions that never returns. When checking for
# inconsistent-return-statements if a never returning function is called then
# it will be considered as an explicit return statement and no message will be
# printed.
never-returning-functions=optparse.Values,sys.exit
[VARIABLES]
# List of additional names supposed to be defined in builtins. Remember that
# you should avoid to define new builtins when possible.
additional-builtins=
# Tells whether unused global variables should be treated as a violation.
allow-global-unused-variables=yes
# List of strings which can identify a callback function by name. A callback
# name must start or end with one of those strings.
callbacks=cb_,
_cb
# A regular expression matching the name of dummy variables (i.e. expectedly
# not used).
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
# Argument names that match this expression will be ignored. Default to name
# with leading underscore
ignored-argument-names=_.*|^ignored_|^unused_
# Tells whether we should check for unused import in __init__ files.
init-import=no
# List of qualified module names which can have objects that can redefine
# builtins.
redefining-builtins-modules=six.moves,past.builtins,future.builtins
[LOGGING]
# Logging modules to check that the string format arguments are in logging
# function parameter format
logging-modules=logging
[TYPECHECK]
# List of decorators that produce context managers, such as
# contextlib.contextmanager. Add to this list to register other decorators that
# produce valid context managers.
contextmanager-decorators=contextlib.contextmanager
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E1101 when accessed. Python regular
# expressions are accepted.
generated-members=
# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
# This flag controls whether pylint should warn about no-member and similar
# checks whenever an opaque object is returned when inferring. The inference
# can return multiple potential results while evaluating a Python object, but
# some branches might not be evaluated, which results in partial inference. In
# that case, it might be useful to still emit no-member and other checks for
# the rest of the inferred objects.
ignore-on-opaque-inference=yes
# List of class names for which member attributes should not be checked (useful
# for classes with dynamically set attributes). This supports the use of
# qualified names.
ignored-classes=optparse.Values,thread._local,_thread._local
# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=blspy,
chiabip158,
chiapos,
chiavdf,
cryptography,
aiohttp,
websockets,
cbor2,
keyring,
keyrings.cryptfile,
bitstring,
clvm_tools,
setproctitle,
clvm,
colorlog,
concurrent_log_handler,
aiosqlite,
sortedcontainers,
aiter,
miniupnpc,
pytest,
setuptools_scm
# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
missing-member-hint=yes
# The minimum edit distance a name should have in order to be considered a
# similar match for a missing member name.
missing-member-hint-distance=1
# The total number of similar names that should be taken in consideration when
# showing a hint for a missing member.
missing-member-max-choices=1
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
notes=FIXME,
XXX,
TODO
[BASIC]
# Naming style matching correct argument names
argument-naming-style=snake_case
# Regular expression matching correct argument names. Overrides argument-
# naming-style
#argument-rgx=
# Naming style matching correct attribute names
attr-naming-style=snake_case
# Regular expression matching correct attribute names. Overrides attr-naming-
# style
#attr-rgx=
# Bad variable names which should always be refused, separated by a comma
bad-names=foo,
bar,
baz,
toto,
tutu,
tata
# Naming style matching correct class attribute names
class-attribute-naming-style=any
# Regular expression matching correct class attribute names. Overrides class-
# attribute-naming-style
#class-attribute-rgx=
# Naming style matching correct class names
class-naming-style=PascalCase
# Regular expression matching correct class names. Overrides class-naming-style
#class-rgx=
# Naming style matching correct constant names
const-naming-style=UPPER_CASE
# Regular expression matching correct constant names. Overrides const-naming-
# style
#const-rgx=
# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1
# Naming style matching correct function names
function-naming-style=snake_case
# Regular expression matching correct function names. Overrides function-
# naming-style
#function-rgx=
# Good variable names which should always be accepted, separated by a comma
good-names=i,
j,
k,
ex,
Run,
_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no
# Naming style matching correct inline iteration names
inlinevar-naming-style=any
# Regular expression matching correct inline iteration names. Overrides
# inlinevar-naming-style
#inlinevar-rgx=
# Naming style matching correct method names
method-naming-style=snake_case
# Regular expression matching correct method names. Overrides method-naming-
# style
#method-rgx=
# Naming style matching correct module names
module-naming-style=snake_case
# Regular expression matching correct module names. Overrides module-naming-
# style
#module-rgx=
# Colon-delimited sets of names that determine each other's naming style when
# the name regexes allow several styles.
name-group=
# Regular expression which should only match function or class names that do
# not require a docstring.
no-docstring-rgx=^_
# List of decorators that produce properties, such as abc.abstractproperty. Add
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty
# Naming style matching correct variable names
variable-naming-style=snake_case
# Regular expression matching correct variable names. Overrides variable-
# naming-style
#variable-rgx=
[SPELLING]
# Limits count of emitted suggestions for spelling mistakes
max-spelling-suggestions=4
# Spelling dictionary name. Available dictionaries: none. To make it working
# install python-enchant package.
spelling-dict=
# List of comma separated words that should not be checked.
spelling-ignore-words=
# A path to a file that contains private dictionary; one word per line.
spelling-private-dict-file=
# Tells whether to store unknown words to indicated private dictionary in
# --spelling-private-dict-file option instead of raising a message.
spelling-store-unknown-words=no
[FORMAT]
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
expected-line-ending-format=
# Regexp for a line that is allowed to be longer than the limit.
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# Number of spaces of indent required inside a hanging or continued line.
indent-after-paren=4
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
# tab).
indent-string=' '
# Maximum number of characters on a single line.
max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000
# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,
dict-separator
# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
# Allow the body of an if to be on the same line as the test if there is no
# else.
single-line-if-stmt=no
[SIMILARITIES]
# Ignore comments when computing similarities.
ignore-comments=yes
# Ignore docstrings when computing similarities.
ignore-docstrings=yes
# Ignore imports when computing similarities.
ignore-imports=no
# Minimum lines number of a similarity.
min-similarity-lines=4
[DESIGN]
# Maximum number of arguments for function / method
max-args=5
# Maximum number of attributes for a class (see R0902).
max-attributes=7
# Maximum number of boolean expressions in a if statement
max-bool-expr=5
# Maximum number of branch for function / method body
max-branches=12
# Maximum number of locals for function / method body
max-locals=15
# Maximum number of parents for a class (see R0901).
max-parents=7
# Maximum number of public methods for a class (see R0904).
max-public-methods=20
# Maximum number of return / yield for function / method body
max-returns=6
# Maximum number of statements in function / method body
max-statements=50
# Minimum number of public methods for a class (see R0903).
min-public-methods=2
[IMPORTS]
# Allow wildcard imports from modules that define __all__.
allow-wildcard-with-all=no
# Analyse import fallback blocks. This can be used to support both Python 2 and
# 3 compatible code, which means that the block might have code that exists
# only in one or another interpreter, leading to false positives when analysed.
analyse-fallback-blocks=no
# Deprecated modules which should not be used, separated by a comma
deprecated-modules=regsub,
TERMIOS,
Bastion,
rexec
# Create a graph of external dependencies in the given file (report RP0402 must
# not be disabled)
ext-import-graph=
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report RP0402 must not be disabled)
import-graph=
# Create a graph of internal dependencies in the given file (report RP0402 must
# not be disabled)
int-import-graph=
# Force import order to recognize a module as part of the standard
# compatibility libraries.
known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
[CLASSES]
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,
__new__,
setUp
# List of member names, which should be excluded from the protected access
# warning.
exclude-protected=_asdict,
_fields,
_replace,
_source,
_make
# List of valid names for the first argument in a class method.
valid-classmethod-first-arg=cls
# List of valid names for the first argument in a metaclass class method.
valid-metaclass-classmethod-first-arg=mcs
[EXCEPTIONS]
# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception

View File

@ -20,7 +20,11 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v1
- name: Checkout Code
uses: actions/checkout@v1
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags
- name: Setup Python environment
uses: actions/setup-python@v1.1.1
@ -71,10 +75,6 @@ jobs:
p12-file-base64: ${{ secrets.APPLE_DEV_ID_APP }}
p12-password: ${{ secrets.APPLE_DEV_ID_APP_PASS }}
# - name: Install MacOS dependencies
# run: |
# brew update
- name: Run install script
env:
INSTALL_PYTHON_VERSION: ${{ matrix.python-version }}

View File

@ -20,7 +20,11 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v1
- name: Checkout Code
uses: actions/checkout@v1
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags
- name: Setup Python environment
uses: actions/setup-python@v1.1.1

View File

@ -13,7 +13,8 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v1
- name: Checkout Code
uses: actions/checkout@v1
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags

67
.github/workflows/linter.yml vendored Normal file
View File

@ -0,0 +1,67 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: GithHub Super Linter
#
# Documentation:
# https://github.com/github/super-linter
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore:
- 'master'
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: docker://github/super-linter:v2.2.0
env:
VALIDATE_ALL_CODEBASE: true
DEFAULT_BRANCH: master
LINTER_RULES_PATH: .github/linters
VALIDATE_YAML: true
VALIDATE_JSON: true
VALIDATE_MD: true
VALIDATE_BASH: true
VALIDATE_PYTHON: true
VALIDATE_JAVASCRIPT_STANDARD: false
VALIDATE_JAVASCRIPT_ES: true
VALIDATE_TYPESCRIPT_ES: true
VALIDATE_DOCKER: true
VALIDATE_GO: true
VALIDATE_POWERSHELL: false
VALIDATE_CSS: false
VALIDATE_ENV: true
DISABLE_ERRORS: false
...

View File

@ -13,10 +13,12 @@ jobs:
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v1
- name: Checkout Code
uses: actions/checkout@v1
with:
fetch-depth: 0
# we need fetch-depth 0 so setuptools_scm can resolve tags
- uses: actions/setup-python@v1
name: Install Python
with:

View File

@ -1,9 +1,11 @@
# Building timelords
The Linux and MacOS chiavdf binary wheels currently exclude an executable
required to run a Timelord. If you want to run a Timelord on Linux or MacOS,
you must install the wheel from source (which may require some additional
development packages) while in the virtual environment.
```
```bash
. ./activate
sh install-timelord.sh

View File

@ -31,7 +31,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- Skylake processors on Windows without AVX would fail to run.
- Harvester no longer runs into 512 maximum file handles open on Windows.
- The version generator for new installers incorrectly handled the "dev" versions after a release tag.
- Due to a python bug, ssl connections could randomly fail. Worked around the issue - https://bugs.python.org/issue29288
- Due to a python bug, ssl connections could randomly fail. Worked around [Python issue 29288](https://bugs.python.org/issue29288)
## [1.0beta7] aka Beta 1.7 - 2020-06-08
@ -157,7 +157,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- Harvester is now asynchronous and will better be able to look up more plots spread across more physical drives.
- Full node startup time has been sped up significantly by optimizing the loading of the blockchain from disk.
# Changed
### Changed
- Most scripts have been removed in favor of chia action commands. You can run `chia version` or `chia start node` for example. Just running `chia` will show you more options. However `chia-create-plots` continues to use the hyphenated form. Also it's now `chia generate keys` as another example.
- Chia start commands like `chia start farmer` and `chia stop node` now keep track of process IDs in a run/ directory in your configuration directory. `chia stop` is unlikely to work on Windows native for now. If `chia start -r node` doesn't work you can force the run/ directory to be reset with `chia start -f node`.
@ -193,7 +193,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- We've made lots of little improvements that should speed up node syncing
- We added full block lookup to `chia show`.
# Changed
### Changed
- `chia-restart-harvester` has been renamed from `chia-start-harvester` to better reflect its functionality. Use it to restart a harvester that's farming so that it will pick up newly finished plots.
- We made the Wallet configurable to connect to a remote trusted node.
@ -201,11 +201,11 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- We updated our miniupnpc dependency to version 2.1.
- We increase the default farmer propagate threshold to reduce chain stall probability.
# Deprecated
### Deprecated
- You should not copy over any prior Wallet database as they are not compatible with Beta3. Your existing full node will not have to re-sync and its database remains compatible.
#Fixed
#### Fixed
- Among a lot of bug fixes was removing a regression that slowed plotting on MacOS by 3 times and may have had smaller impacts on plotting speed on other platforms.
- We've removed some race conditions in the Wallet
@ -230,7 +230,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- If youre a farmer you can use the Wallet to keep track of your earnings. Either use the same keys.yaml on the same machine or copy the keys.yaml to another machine where you want to track of and spend your coins.
- We have continued to make improvements to the speed of VDF squaring, creating a VDF proof, and verifying a VDF proof.
# Changed
### Changed
- We have revamped the chia management command line. To start a farmer all you have to do is start the venv with `. ./activate` and then type `chia-start-farmer &`. The [README.md](https://github.com/Chia-Network/chia-blockchain/blob/master/README.md) has been updated to reflect the new commands.
- We have moved all node to node communication to TLS 1.3 by default. For now, all TLS is unauthenticated but certain types of over the wire node to node communications will have the ability to authenticate both by certificate and by inter protocol signature. Encrypting over the wire by default stops casual snooping of transaction origination, light wallet to trusted node communication, and harvester-farmer-node communication for example. This leaves only the mempool and the chain itself open to casual observation by the public and the various entities around the world.
@ -243,7 +243,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- Developer requirements were separated from the actual requirements.
- `install-timelord.sh` has been pulled out from `install.sh`. This script downloads the source python package for chiavdf and compiles it locally for timelords. vdf_client can be included or excluded to make building normal user wheels easier.
# Removed
### Removed
- The Beta release is not compatible with the history of the Alpha blockchain and we will be ceasing support of the Alpha chain approximately two weeks after the release of this Beta. However, your plots and keys are fully compatible with the Beta chain. Please save your plot keys! Examples of how to save your keys and upgrade to the Beta are available on the [repo wiki](https://github.com/Chia-Network/chia-blockchain/wiki).
- The ssh ui and web ui are removed in favor of the cli ui and the Electron GUI. To mimic the ssh ui try `chia show -s -c` and try `chia show --help` for usage instructions.
@ -267,7 +267,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
- You can now provide an index to create_plots using the -i flag to create an arbitrary new plot derived from an existing plot key. Thanks @xorinox.
- There is a new restart_harvester.sh in scripts/ to easily restart a harvester when you want to add a newly completed plot to the farm without restarting farmer, fullnode, timelord, etc.
- Harvesters now log errors if they encounter a malformed or corrupted plot file. Again thanks @xorinox.
- New AJAX based full node UI. To access go to http://127.0.0.1:8555/index.html with any modern web browser on the same machine as the full node.
- New AJAX based full node UI. To access go to [http://127.0.0.1:8555/index.html](http://127.0.0.1:8555/index.html) with any modern web browser on the same machine as the full node.
- If you want to benchmark your CPU as a VDF you can use vdf_bench square_asm 500000 for the assembly optimized test or just vdf_bench square 500000 for the plain C++ code path. This tool is found in lib/chiavdf/fast_vdf/.
- Improvements to shutting down services in all of the scripts in scripts/. Another @xorinox HT.
@ -400,7 +400,7 @@ timelord.sanitizer_mode = True, the timelord will work on those challenges.
### Added
- This is the first release of the Chia testnet! Blockchain consensus, proof of time, and proof of space are included.
- More details on the release at https://www.chia.net/developer/
- More details on the release at [https://www.chia.net/developer/](https://www.chia.net/developer/)
[unreleased]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta5...dev
[1.0beta5]: https://github.com/Chia-Network/chia-blockchain/compare/1.0beta4...1.0beta5

View File

@ -1,4 +1,5 @@
## Introduction
# Introduction
Welcome to the chia-blockchain project!
We are happy that you are taking a look at the code for Chia, a proof of space and time cryptocurrency.
@ -8,16 +9,16 @@ It also includes a verifiable delay function implementation that it imports from
If you want to learn more about this project, read the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki), or check out the [green paper](https://www.chia.net/assets/ChiaGreenPaper.pdf).
### Contributions
## Contributions
We would be pleased to accept code contributions to this project.
As we are in the alpha stage, the main priority is getting a robust blockchain up and running, with as many of the mainnet features as possible.
You can visit our [Trello project board](https://trello.com/b/ZuNx7sET) to get a sense of what is in the backlog.
Generally things to the left are in progress or done. Some things go through "Coming up soon" but some will come directly out of other columns.
Usually the things closer to the top of each column are the ones that will be worked on soonest.
If you are interested in cryptography, math, or just like hacking in python, there are many interesting problems to work on.
Contact any of the team members on keybase: https://keybase.io/team/chia_network.public, which we use as the main communication method and you can comment on any Trello card.
Contact any of the team members on [Keybase](https://keybase.io/team/chia_network.public), which we use as the main communication method and you can comment on any Trello card.
### Run tests and linting
## Run tests and linting
The first time the tests are run, BlockTools will create and persist many plots. These are used for creating
proofs of space during testing. The next time tests are run, this won't be necessary.
@ -30,7 +31,7 @@ py.test tests -s -v
Black is used as an automatic style formatter to make things easier, and flake8 helps ensure consistent style.
Mypy is very useful for ensuring objects are of the correct type, so try to always add the type of the return value, and the type of local variables.
### Configure VS code
## Configure VS code
1. Install Python extension
2. Set the environment to ./venv/bin/python
3. Install mypy plugin
@ -39,8 +40,8 @@ Mypy is very useful for ensuring objects are of the correct type, so try to alwa
7. Preferences > Settings > Formatting > Python > Provider > black
6. Preferences > Settings > mypy > Targets: set to ./src and ./tests
### Submit changes
## Submit changes
To submit changes, please make a pull request to the `dev` development branch.
### Copyright
## Copyright
By contributing to this repository, you agree to license your work under the Apache License Version 2.0, or the MIT License, or release your work to the public domain. Any work contributed where you are not the original author must contain its license header with the original author(s) and be in the public domain, or licensed under the Apache License Version 2.0 or the MIT License.

View File

@ -2,4 +2,6 @@
Install instructions have been moved to the [INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL) section of the repository [Wiki](https://github.com/Chia-Network/chia-blockchain/wiki)
After installing, follow the remaining instructions in the [Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide) to run the software.
After installing, follow the remaining instructions in the
[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide)
to run the software.

View File

@ -1,10 +1,11 @@
# chia-blockchain
![Alt text](https://www.chia.net/img/chia_logo.svg)
| Current Release/master | Development Branch/dev |
| :---: | :---: |
| ![Build Ubuntu and MacOS](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Ubuntu%20and%20MacOS/badge.svg) ![Build Windows Installer](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Windows%20Installer/badge.svg) | ![Build Ubuntu and MacOS](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Ubuntu%20and%20MacOS/badge.svg?branch=dev) ![Build Windows Installer](https://github.com/Chia-Network/chia-blockchain/workflows/Build%20Windows%20Installer/badge.svg?branch=dev) |
![GitHub contributors](https://img.shields.io/github/contributors/Chia-Network/chia-blockchain?logo=GitHub)
# chia-blockchain
Please check out the [wiki](https://github.com/Chia-Network/chia-blockchain/wiki)
and [FAQ](https://github.com/Chia-Network/chia-blockchain/wiki/FAQ) for
information on this project.
@ -24,13 +25,13 @@ Building timelords and VDFs is for sophisticated users in most environments.
Chia Network and additional volunteers are running sufficient Timelords
for testnet consensus.
# Installing
## Installing
Install instructions are available in the
[INSTALL](https://github.com/Chia-Network/chia-blockchain/wiki/INSTALL)
section of the
[chia-blockchain repository wiki](https://github.com/Chia-Network/chia-blockchain/wiki).
# Running
## Running
Once installed, a
[Quick Start Guide](https://github.com/Chia-Network/chia-blockchain/wiki/Quick-Start-Guide)
is available from the repository

View File

@ -3,7 +3,7 @@
# The environment variable CHIA_INSTALLER_VERSION needs to be defined
CHIA_INSTALLER_VERSION=$(python installer-version.py)
if [ ! $CHIA_INSTALLER_VERSION ]; then
if [ ! "$CHIA_INSTALLER_VERSION" ]; then
echo "WARNING: No environment variable CHIA_INSTALLER_VERSION set. Using 0.0.0."
CHIA_INSTALLER_VERSION="0.0.0"
fi
@ -22,8 +22,8 @@ echo "Create executeables with pyinstaller"
pip install pyinstaller
sudo pyinstaller --log-level=INFO daemon.spec
cp -r dist/daemon ../electron-react
cd ..
cd electron-react
cd .. || exit
cd electron-react || exit
echo "npm build"
npm install
@ -31,7 +31,7 @@ npm run build
electron-packager . Chia --asar.unpack="**/daemon/**" --platform=darwin --icon=src/assets/img/Chia.icns --overwrite --app-bundle-id=net.chia.blockchain
electron-osx-sign Chia-darwin-x64/Chia.app --no-gatekeeper-assess --platform=darwin --hardened-runtime --provisioning-profile=chiablockchain.provisionprofile --entitlements=entitlements.mac.plist --entitlements-inherit=entitlements.mac.plist
mv Chia-darwin-x64 ../build_scripts/dist/
cd ../build_scripts
cd ../build_scripts || exit
echo "Create .dmg"
mkdir final_installer

View File

@ -1,15 +1,15 @@
# $env:path should contain a path to editbin.exe and signtool.exe
mkdir build_scripts\win_build
cd build_scripts\win_build
Set-Location -Path ".\build_scripts\win_build" -PassThru
Write-Output " ---"
Write-Output "curl miniupnpc, setproctitle"
Write-Output " ---"
curl -OL --show-error --fail https://download.chia.net/simple/miniupnpc/miniupnpc-2.1-cp37-cp37m-win_amd64.whl
curl -OL --show-error --fail https://download.chia.net/simple/setproctitle/setproctitle-1.1.10-cp37-cp37m-win_amd64.whl
Invoke-WebRequest -Uri "https://download.chia.net/simple/miniupnpc/miniupnpc-2.1-cp37-cp37m-win_amd64.whl" -OutFile "miniupnpc-2.1-cp37-cp37m-win_amd64.whl"
Invoke-WebRequest -Uri "https://download.chia.net/simple/setproctitle/setproctitle-1.1.10-cp37-cp37m-win_amd64.whl" -OutFile "setproctitle-1.1.10-cp37-cp37m-win_amd64.whl"
Write-Output "Using win_amd64 python 3.7 wheel from https://github.com/miniupnp/miniupnp/pull/475 (2.2.0-RC1)"
cd ..\..
Set-Location -Path - -PassThru
Write-Output " ---"
Write-Output "Create venv - python3.7 or 3.8 is required in PATH"
@ -43,7 +43,7 @@ Write-Output "Install chia-blockchain wheels into venv with pip"
Write-Output " ---"
Write-Output "pip install miniupnpc"
cd build_scripts
Set-Location -Path ".\build_scripts" -PassThru
pip install --no-index --find-links=.\win_build\ miniupnpc
Write-Output "pip install setproctitle"
pip install --no-index --find-links=.\win_build\ setproctitle
@ -53,13 +53,13 @@ pip install --no-index --find-links=.\win_build\ chia-blockchain
Write-Output " ---"
Write-Output "Use pyinstaller to create chia .exe's"
Write-Output " ---"
pyinstaller --log-level TRACE daemon_windows.spec
pyinstaller --log-level INFO daemon_windows.spec
Write-Output " ---"
Write-Output "Copy chia executables to electron-react/"
Write-Output "Copy chia executables to electron-react\"
Write-Output " ---"
cp -r dist/daemon ../electron-react/
cd ../electron-react
Copy-Item "dist\daemon" -Destination "..\electron-react\" -Recurse
Set-Location -Path "..\electron-react" -PassThru
Write-Output " ---"
Write-Output "Prepare Electron packager"
@ -76,7 +76,6 @@ npm run build
Write-Output " ---"
Write-Output "Increase the stack for chiapos"
# editbin.exe needs to be in the path
#Start-Process "editbin.exe" -ArgumentList "/STACK:8000000 daemon\create_plots.exe" -Wait
editbin.exe /STACK:8000000 daemon\create_plots.exe
Write-Output " ---"
@ -87,7 +86,7 @@ Write-Output "packageName is $packageName"
Write-Output " ---"
Write-Output "electron-packager"
electron-packager . Chia --asar.unpack="**/daemon/**" --overwrite --icon=.\src\assets\img\chia.ico --app-version=$packageVersion
electron-packager . Chia --asar.unpack="**\daemon\**" --overwrite --icon=.\src\assets\img\chia.ico --app-version=$packageVersion
Write-Output " ---"
Write-Output " ---"

View File

@ -6,8 +6,7 @@ find_python() {
unset BEST_VERSION
for V in 37 3.7 38 3.8 3
do
which python$V > /dev/null
if [ $? = 0 ]
if which python$V > /dev/null
then
if [ x"$BEST_VERSION" = x ]
then
@ -67,6 +66,7 @@ if [ ! -f "activate" ]; then
ln -s venv/bin/activate .
fi
echo "Python version is $INSTALL_PYTHON_VERSION"
# shellcheck disable=SC1091
. ./activate
# pip 20.x+ supports Linux binary wheels
pip install --upgrade pip
@ -98,7 +98,7 @@ fi
# We will set up node.js on GitHub Actions and Azure Pipelines directly
# for Mac and Windows so skip unless completing a source/developer install
# Ubuntu special cases above
if [ ! $CI ]; then
if [ ! "$CI" ]; then
cd ./electron-react
npm install
npm audit fix

View File

@ -1,7 +1,8 @@
#!/bin/bash
python3 -m venv venv
# shellcheck disable=SC1091
. ./activate
pip3 install .
py.test ./tests -s -v
py.test ./tests -s -v

View File

@ -35,6 +35,7 @@ def make_sized_bytes(size):
@classmethod # type: ignore
def from_bytes(cls: Any, blob: bytes) -> Any:
# pylint: disable=no-member
f = io.BytesIO(blob)
return cls.parse(f)

View File

@ -19,7 +19,7 @@ def calculate_cost_of_program(
total_clvm_cost = 0
error, npc_list, cost = get_name_puzzle_conditions(program)
if error:
raise
raise Exception('get_name_puzzle_conditions raised error' + str(error))
total_clvm_cost += cost
# Add cost of conditions

View File

@ -154,7 +154,7 @@ class CCWallet:
"CC Wallet", WalletType.COLOURED_COIN, info_as_string
)
if self.wallet_info is None:
raise
raise Exception('wallet_info is None')
await self.wallet_state_manager.add_new_wallet(self, self.wallet_info.id)
return self

View File

@ -87,7 +87,7 @@ class RLWallet:
)
wallet_info = await wallet_state_manager.user_store.get_last_wallet()
if wallet_info is None:
raise
raise Exception('wallet_info is None')
await wallet_state_manager.puzzle_store.add_derivation_paths(
[
@ -139,7 +139,7 @@ class RLWallet:
)
wallet_info = await wallet_state_manager.user_store.get_last_wallet()
if wallet_info is None:
raise
raise Exception('wallet_info is None')
self = await RLWallet.create(
config, key_config, wallet_state_manager, wallet_info, wallet, name
@ -343,7 +343,7 @@ class RLWallet:
puzzle_hash
)
if index_for_puzzlehash == -1:
raise
raise Exception('index_for_puzzlehash == -1')
pubkey = self.private_key.public_child(index_for_puzzlehash).get_public_key()
private = self.private_key.private_child(index_for_puzzlehash).get_private_key()
return pubkey, private
@ -356,7 +356,7 @@ class RLWallet:
clawback_pubkey.hex()
)
if index_for_pubkey == -1:
raise
raise Exception('index_for_pubkey == -1')
pubkey = self.private_key.public_child(index_for_pubkey).get_public_key()
private = self.private_key.private_child(index_for_pubkey).get_private_key()
return pubkey, private
@ -446,7 +446,7 @@ class RLWallet:
or self.rl_info.user_pubkey is None
or self.rl_info.admin_pubkey is None
):
raise
raise Exception('One ore more of the elements of rl_info is None')
spends = []
coin = clawback_coin
puzzle = rl_puzzle_for_pk(
@ -483,7 +483,7 @@ class RLWallet:
async def clawback_rl_coin(self, clawback_puzzle_hash: bytes32):
rl_coin = await self.get_rl_coin()
if rl_coin is None:
raise
raise Exception('rl_coin is None')
transaction = self.generate_unsigned_clawback_transaction(
rl_coin, clawback_puzzle_hash
)
@ -503,7 +503,7 @@ class RLWallet:
or rl_info.user_pubkey is None
or rl_info.admin_pubkey is None
):
raise
raise Exception('One ore more of the elements of rl_info is None')
list_of_coinsolutions = []