Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Prompt history file persistence, purged password from history during send, build instructions update #34

Merged
merged 4 commits into from
Oct 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

## Getting started

You will need to install the libleveldb library. Install [Python 3.5](https://www.python.org/downloads/release/python-354/) to make sure you don't run into any issues with your version of Python being different than the current maintainer's version.
You will need to install the libleveldb library. Install [Python 3.5](https://www.python.org/downloads/release/python-354/) to make sure you don't run into any issues with your version of Python being different than the current maintainer's version. Note that Python 3.6 is not currently supported due to incompatibilities with the byteplay module.

We have published a Youtube [video](https://youtu.be/oy6Z_zd42-4) to help get you started with this library. There are other videos under the CityOfZion Youtube channel.

Expand Down Expand Up @@ -117,17 +117,24 @@ You may need to uninstall plyvel (python libleveldb library), and reinstall with

```
pip uninstall plyvel
CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel plyvel --no-cache-dir
CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel plyvel --no-cache-dir --global-option=build_ext --global-option="-I/usr/local/Cellar/leveldb/1.20_2/include/" --global-option="-L/usr/local/lib"
```

Moreover, this pip installation must see the leveldb header file db.h.
You may need to add flags similar to the following to the
installation command
You may also encounter issues when installing the pycrypto module on OSX:

```
--global-option=build_ext
--global-option="-I/usr/local/Cellar/leveldb/1.20_2/include/"
--global-option="-L/usr/local/lib"
src/_fastmath.c:36:11: fatal error: 'gmp.h' file not found
# include <gmp.h>
^~~~~~~
330 warnings and 1 error generated.
error: command 'clang' failed with exit status 1
```

This may be fixed by installing the gmp library using homebrew and running pip install with the following commandline:

```
brew install gmp
CFLAGS='-mmacosx-version-min=10.7 -stdlib=libc++' pip install --no-use-wheel pycrypto --no-cache-dir --global-option=build_ext --global-option="-I/usr/local/Cellar/gmp/6.1.2/include/" --global-option="-L/usr/local/lib"
```

## Running
Expand Down Expand Up @@ -229,4 +236,4 @@ coverage report -m --omit=venv/*

## Donations

Accepted at __ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU__
Accepted at __ATEMNPSjRVvsXmaJW4ZYJBSVuJ6uR2mjQU__
8 changes: 1 addition & 7 deletions neo/Prompt/Commands/Send.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,7 @@ def construct_and_send(prompter, wallet, arguments):
print("insufficient funds")
return


passwd = prompt("[Password]> ",
completer=prompter.completer,
is_password=True,
history=prompter.history,
get_bottom_toolbar_tokens=prompter.get_bottom_toolbar,
style=prompter.token_style)
passwd = prompt("[Password]> ", is_password=True)

if not wallet.ValidatePassword(passwd):
print("incorrect password")
Expand Down
2 changes: 1 addition & 1 deletion neo/VM/ExecutionEngine.py
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ def StepInto(self):

# opname = ToName(op)
# print("____________________________________________________")
# print("%s -> %s" % (op, opname))
# print("%02x -> %s" % (int.from_bytes(op,byteorder='little'), opname))
# print("-----------------------------------")

self.ops_processed += 1
Expand Down
75 changes: 74 additions & 1 deletion neo/VM/OpCode.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,79 @@
PUSH0 = b'\x00' # An empty array of bytes is pushed onto the stack.
PUSHF = PUSH0
PUSHBYTES1 = b'\x01' # b'\x01-b'\x4B The next opcode bytes is data to be pushed onto the stack
PUSHBYTES2 = b'\x02'
PUSHBYTES3 = b'\x03'
PUSHBYTES4 = b'\x04'
PUSHBYTES5 = b'\x05'
PUSHBYTES6 = b'\x06'
PUSHBYTES7 = b'\x07'
PUSHBYTES8 = b'\x08'
PUSHBYTES9 = b'\x09'
PUSHBYTES10 = b'\x0A'
PUSHBYTES11 = b'\x0B'
PUSHBYTES12 = b'\x0C'
PUSHBYTES13 = b'\x0D'
PUSHBYTES14 = b'\x0E'
PUSHBYTES15 = b'\x0F'
PUSHBYTES16 = b'\x10'
PUSHBYTES17 = b'\x11'
PUSHBYTES18 = b'\x12'
PUSHBYTES19 = b'\x13'
PUSHBYTES20 = b'\x14'
PUSHBYTES21 = b'\x15'
PUSHBYTES22 = b'\x16'
PUSHBYTES23 = b'\x17'
PUSHBYTES24 = b'\x18'
PUSHBYTES25 = b'\x19'
PUSHBYTES26 = b'\x1A'
PUSHBYTES27 = b'\x1B'
PUSHBYTES28 = b'\x1C'
PUSHBYTES29 = b'\x1D'
PUSHBYTES30 = b'\x1E'
PUSHBYTES31 = b'\x1F'
PUSHBYTES32 = b'\x20'
PUSHBYTES33 = b'\x21'
PUSHBYTES34 = b'\x22'
PUSHBYTES35 = b'\x23'
PUSHBYTES36 = b'\x24'
PUSHBYTES37 = b'\x25'
PUSHBYTES38 = b'\x26'
PUSHBYTES39 = b'\x27'
PUSHBYTES40 = b'\x28'
PUSHBYTES41 = b'\x29'
PUSHBYTES42 = b'\x2A'
PUSHBYTES43 = b'\x2B'
PUSHBYTES44 = b'\x2C'
PUSHBYTES45 = b'\x2D'
PUSHBYTES46 = b'\x2E'
PUSHBYTES47 = b'\x2F'
PUSHBYTES48 = b'\x30'
PUSHBYTES49 = b'\x31'
PUSHBYTES50 = b'\x32'
PUSHBYTES51 = b'\x33'
PUSHBYTES52 = b'\x34'
PUSHBYTES53 = b'\x35'
PUSHBYTES54 = b'\x36'
PUSHBYTES55 = b'\x37'
PUSHBYTES56 = b'\x38'
PUSHBYTES57 = b'\x39'
PUSHBYTES58 = b'\x3A'
PUSHBYTES59 = b'\x3B'
PUSHBYTES60 = b'\x3C'
PUSHBYTES61 = b'\x3D'
PUSHBYTES62 = b'\x3E'
PUSHBYTES63 = b'\x3F'
PUSHBYTES64 = b'\x40'
PUSHBYTES65 = b'\x41'
PUSHBYTES66 = b'\x42'
PUSHBYTES67 = b'\x43'
PUSHBYTES68 = b'\x44'
PUSHBYTES69 = b'\x45'
PUSHBYTES70 = b'\x46'
PUSHBYTES71 = b'\x47'
PUSHBYTES72 = b'\x48'
PUSHBYTES73 = b'\x49'
PUSHBYTES74 = b'\x4A'
PUSHBYTES75 = b'\x4B'
PUSHDATA1 = b'\x4C' # The next byte contains the number of bytes to be pushed onto the stack.
PUSHDATA2 = b'\x4D' # The next two bytes contain the number of bytes to be pushed onto the stack.
Expand Down Expand Up @@ -145,7 +218,7 @@ def ToName(op):
n = getattr(module, item)

try:
nn = int(binascii.hexlify(n))
nn = int(binascii.hexlify(n), 16)

if op == nn:
return item
Expand Down
6 changes: 3 additions & 3 deletions prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
from prompt_toolkit.shortcuts import print_tokens
from prompt_toolkit.token import Token
from prompt_toolkit.contrib.completers import WordCompleter
from prompt_toolkit.history import InMemoryHistory
from prompt_toolkit.history import FileHistory


logname = 'prompt.log'
Expand Down Expand Up @@ -103,7 +103,7 @@ class PromptInterface(object):
'config log {on/off}',
'import wif {wif}',
'import contract {path} {params} {returntype}',
'export wif {address}'
'export wif {address}',
'open wallet {path}',
'create wallet {path}',
'wallet {verbose}',
Expand All @@ -121,7 +121,7 @@ class PromptInterface(object):
Token.Number: "#ffffff",
})

history = InMemoryHistory()
history = FileHistory('.prompt.py.history')

start_height = Blockchain.Default().Height
start_dt = datetime.datetime.utcnow()
Expand Down