Fixes one more instruction being ran when VM FAULTs:
NEO-GO-VM > run
NEO-GO-VM > error encountered at instruction 6 (ROLL)
NEO-GO-VM > runtime error: invalid memory address or nil pointer dereference
FAULT
NEO-GO-VM > error encountered at instruction 7 (SETITEM)
NEO-GO-VM > interface conversion: interface {} is []vm.StackItem, not []uint8
Refs. #96.
And drop associated _pkg.dev remnants (refs. #307).
Original `dev` branch had two separate packages for public and private keys,
but those are so intertwined (`TestHelper` subpackage is a proof) that it's
better unite them and all associated code (like WIF and NEP-2) in one
package. This patch also:
* creates internal `keytestcases` package to share things with wallet (maybe
it'll be changed in some future)
* ports some tests from `dev`
* ports Verify() method for public key from `dev`
* expands TestPrivateKey() with public key check
Simplifies a lot of code and removes some duplication. Unfortunately I had to
move test_util random functions in same commit to avoid cycle
dependencies. One of these random functions was also used in core/transaction
testing, to simplify things I've just dropped it there and used a static
string (which is nice to have for a test anyway).
There is still sha256 left in wallet (but it needs to pass Hash structure into
the signing function).
Go's Hash is explicitly specified to never return an error on Write(), and our
own decoding functions only check for length which is gonna be right in every
case so it makes no sense returning errors from these functions.
With associated test and drop duplicating Uint160 implementation from
_pkg.dev. It doesn't seem to be used in pkg code at the moment, but still it
can be useful. Refs #307.
Unfortunately d58fbe0c88 didn't really fix the
problem because tinfo.Type (the expression resulting type) actually is a bool
and we need to check its parameters. Also, there is need to fix the NEQ
operation.
neo-storm has developed more wrappers for syscall APIs, so they can and should
be used as a drop-in replacement for pkg/vm/api. Moving it out of vm, as it's
not exactly related to the VM itself.
These were interpreted completely wrong, they actually have two next bytes
indicating an offset. This patch is a quick fix, actually more work is needed
here to properly display various instructions.
This is wrong, see issue #294, but it makes our VM tests work (as VM is
missing EQUAL implementation), so until #294 is properly resolved we're better
have this kind of wrong code generation.
* Fixed bug in else stmts
* Fixed if else bug
* Back to %v for formatting instructions
Imported from CityOfZion/neo-storm (ea8440e1454207753c8d209ce7c2cf724fd4ea16).
* Fixed bug where void functions cleaned up their mess multiple times
* Compiler improvements
* Fixed Neo APIs naming convention
* Added NOP after syscall for matching AVM files with neo-python.
Imported from CityOfZion/neo-storm (f93a28ef87d272a74f821d45ae0c6735a8c610be).
* Draft of iterator and enumerator
* Added iterator API to the syscall mapping
* Added draft of the enumerator.go file
* Added enumerator interop API.
* Updated the changelog
Imported from CityOfZion/neo-storm (156093318b8612e810965bb1ea26e1babfb46cdd).
* new mapping for interop api
* Fixed interop API mapping + added missing apis
* added engine apis
Imported from CityOfZion/neo-storm (ec5e6c8e2b587704a1e071e83b633d2d3a235300).
* Added new config attributes: 'SecondsPerBlock','LowPriorityThreshold'
* Added new files:
* Added new method: CompareTo
* Fixed empty Slice case
* Added new methods: LessThan, GreaterThan, Equal, CompareTo
* Added new method: InputIntersection
* Added MaxTransactionSize, GroupOutputByAssetID
* Added ned method: ScriptHash
* Added new method: IsDoubleSpend
* Refactor blockchainer, Added Feer interface, Verify and GetMemPool method
* 1) Added MemPool
2) Added new methods to satisfy the blockchainer interface: IsLowPriority, Verify, GetMemPool
* Added new methods: RelayTxn, RelayDirectly
* Fixed tests
* Implemented RPC server method sendrawtransaction
* Refactor getrawtransaction, sendrawtransaction in separate methods
* Moved 'secondsPerBlock' to config file
* Implemented Kim suggestions:
1) Fixed data race issues
2) refactor Verify method
3) Get rid of unused InputIntersection method due to refactoring Verify method
4) Fixed bug in https://github.com/CityOfZion/neo-go/pull/174#discussion_r264108135
5) minor simplications of the code
* Fixed minor issues related to
1) space
2) getter methods do not need pointer on the receiver
3) error message
4) refactoring CompareTo method in uint256.go
* Fixed small issues
* Use sync.RWMutex instead of sync.Mutex
* Refined (R)Lock/(R)Unlock
* return error instead of bool in Verify methods
* Added utility function GetVarSize
* 1) Added Size method: this implied that Fixed8 implements now the serializable interface. 2) Added few arithmetic operation (Add, Sub, div): this will be used to calculated networkfeeand feePerByte. Changed return value of the Value() method to int instead of int64. Modified fixed8_test accordingly.
* Implemented Size or MarshalJSON method.
- Structs accepting the Size method implement the serializable interface.
- Structs accepting the MarshalJSON method implements the customized json marshaller interface.
* Added fee calculation
* Implemented rcp server method GetRawTransaction
* Updated Tests
* Fixed:
1) NewFixed8 will accept as input int64
2) race condition affecting configDeafault, blockchainDefault
* Simplified Size calculation
* 1) Removed global variable blockchainDefault, configDefault
2) Extended Blockchainer interface to include the methods: References, FeePerByte, SystemFee, NetworkFee
3) Deleted fee_test.go, fee.go. Moved corresponding methods to blockchain_test.go and blockchain.go respectively
4) Amended tx_raw_output.go
* Simplified GetVarSize Method
* Replaced ValueAtAndType with ValueWithType
* Cosmetic changes + Added test case getrawtransaction_7
* Clean up Print statement
* Filled up keys
* Aligned verbose logic with the C#-neo implementation
* Implemented @Kim requests
Refactor server_test.go
* Small fixes
* Fixed verbose logic
Added more tests
Cosmetic changes
* Replaced assert.NoError with require.NoError
* Fixed tests by adding context.Background() as argument
* Fixed tests
* small fixes
* gofmt
* fix in raw tx build
* fixes after review
* balance getter interface
* moved address and signature calculation to public key
* errors handling
* PublicKey() returns PublicKey instead of bytes slice
* fixes after review
* fixes after review
* public key creation from asn1 serialized key
* small fixes
* gofmt
* fix in raw tx build
* fixes after review
* balance getter interface
* moved address and signature calculation to public key
* errors handling
* PublicKey() returns PublicKey instead of bytes slice
* fixes after review
* fixes after review
* Fix#130: Wrong answer for RPC server method getaccountstate
- fixed RPC Server response
- fixed RPC Server tests
- remove unused package from go.mod
* add index and type checker
* fix review comments (thx @aprasolova)
- balancer / wif / http.Client could be with data race
- add getter / setter with sync.Mutex
- now http.Client is pointer
- now you can provide your http.Client to rpcClient
* Implemented rcp method GetAccountState
* code clean up
* Removed empty line
* Used consistently github.com/pkg/errors package. Amended error message
* Get rid of fmt.Sprintf and use either errors.Errorf or errors.Wrapf
* cosmetic changes
* Fixed small incosistencies related to comments and variable name
* For testing purposes we have to move the method newBlockchain from the cli/server/server.go to pkg/core/blockchain.go. In addition we have to rename it to NewBlockchainLevelDB in order to be able to export it and avoid naming conflicts. In future we still need to think how to switch between different blockchain implementation easily but for the time being this is not possible.
* Added unit tests for the rpc server
* Added unit_testnet chain fixture
* fixed port number
* Added errors handling
* move unit_testnet chain from 'cli/chains' to 'pkg/rpc/chains'
* func to get private key from raw bytes
* added function to create raw transfer tx
* fixes
* more fixes
* prettify code and comments; neoscan interaction put in dedicated files
* added runtime serialize and deserialize functions
* removed getCurrentBlock from runtime functions
* Added block and header stdlib interop functions
* added transaction interop api
* added asset interop api
* bumped version
* Added missing storage.Find storage API function
* Fixed wrong example in the compiler README
* updated the compiler README to be more accurate on compiler features
* Initial draft of the ICO template ported from NEX.
* filled in token configuration
* added kyc storage prefix
* fixed byte array conversion + added tests
* fixed broken test + made 1 file for the token sale example.
* implemented the NEP5 handlers
* bumped version
* support VM to pass method and arguments to a script.
* added support for type assertions in smartcontracts.
* added native vm support for print.
* moved VM API packages to vm -> API
* reverted the native Print opcode in favor of runtime.Log
* added support for registering custom interop hooks in the VM.
* Updated README
* Updated compiler with @OPTIMIZE tags
* Moved more tests to VM package.
* optimized and refactored compiler and vm API
* updated README with new smartcontract apis
* bumped version
* Made Encode/Decode message public.
* Added Redis storage driver and made some optimizations for the initialising the blockchain
* removed log lines in tcp_peer
* Added missing comments on exported methods.
* bumped version
* renamed test folders and fixed bug where wrong jump labels would be exectuted for rewrite.
* Added support for Osize (len(string)) and factored out the array tests
* Added current instruction number to VM prompt if program is loaded.
* added support for unary expressions.
* updated README of and sorted the help commands
* updated readme of the compiler
* bumped version -> 0.39.0
* changed vm commands to match more of the standard
* fixed Uint16 jmp bug in VM
* moved test to vm + fixed numnotequal bug
* fixed broken tests
* moved compiler tests to vm tests
* added basic for support + inc and dec stmts
* bumped version
* Virtual machine for the NEO blockhain.
* fixed big.Int numeric operation pointer issue.
* added appcall
* Added README for vm package.
* removed main.go
* started VM cli (prompt) integration
* added support for printing the stack.
* moved cli to vm package
* fixed vet errors
* updated readme
* added more test for VM and fixed some edge cases.
* bumped version -> 0.37.0
* Few tweaks to improve output of `getblock`
* Adds few more fields and corrects witness
* Bumps version
* Only reverse when marshalling for moment
* Adds README for rpc package
* Few updates
* Typo
* Adds link in main readme
* Fix readme link
* implemented operation and param flags in the cli invoke cmd.
* reverted prev changes and added debug flag for compiling.
* change transactionType variable to Type, for package convention
* index support for arrays.
* implemented builtin (len) for the compiler.
* bumped version -> 0.35.0
* updated compiler README and changed invoke to testinvoke.
* Adds basic RPC supporting files
* Adds interrupt handling and error chan
* Add getblock RPC method
* Update request structure
* Update names of nodes
* Allow bad addresses to be registered in discovery externally
* Small tidy up
* Few tweaks
* Check if error is close error in tcp transport
* Fix tests
* Fix priv port
* Small tweak to param name
* Comment fix
* Remove version from server
* Moves submitblock to TODO block
* Remove old field
* Bumps version and fix hex issues
* added account_state + changed ECPoint to PublicKey
* account state persist
* in depth test for existing accounts.
* implemented GetTransaction.
* added enrollment TX
* added persist of accounts and unspent coins
* bumped version -> 0.32.0
* Created test_data folder with block json files for testing + create separate file for block base.
* Fixed bug in WriteVarUint + Trim logic + unit tests
* Refactored store and add more tests for it.
* restore headerList from chain file
* Fix tx decode bug + lots of housekeeping.
* Implemented Node restore state from chain file.
* Created standalone package for storage. Added couple more methods to Batch and Store interfaces.
* Block persisting + tests
* bumped version -> 0.31.0
* Adds struct for config settings
* Bumps version
* Move settings around
* Only push version tag up not whole branch as well
* Move config into own path and add test and main nets
* Update config for timeouts
* Convert to yaml
* block partial persist
* replaced refactored files with old one.
* removed gokit/log from deps
* Tweaks to not overburden remote nodes with getheaders/getblocks
* Changed Transporter interface to not take the server as argument due to a cause of race warning from the compiler
* started server test suite
* more test + return errors from message handlers
* removed --race from build
* Little improvements.
* Started RPC package to allow querying balances and sending raw transactions for sc's
* integrate invoke cmd in cli
* bumped version
* added sendrawtransaction to the rpc client.
* deleted transfer_output added asset type and transaction result to core
* removed writing 0x00 when buffer length is 0
* Refactored emit into VM package + moved tx to own package.
* implemented transaction along with claimTransaction.
* refactored naming of transaction + added decode address for uint160 types
* removed unnecessary folder and files.
* transaction/smartcontract logic
* bumped version 0.24.0
* Disconnect once go routines signal so
* Send msg if cmd is other than cmdUnknown
* Remove typo
* Fix lock file
* Updates README
* Comment typo
* Fix issue
* Revert old changes
* Handle error
* Initial draft of the neo-go wallet
* Cleanup + more test for util package
* integrated wallet into neo-cli partially
* base wallet implementation + smartcontract code.
* implemented global variables.
* refactored imports + lots and lots of other sweet stuff + fix#28.
* Implemented the VM interop runtime API (GetTrigger, CheckWitness, ...)
* Print proper error messages while using contract subcommands and also exit with status code 1.
* Make -in a flag, also remove dot from avm extension.
* Work on feedback by Anthony.
* Update README and VERSION
* implemented add, mul, div, sub assign for identifiers.
* Implemented struct field initialization.
* Implemented imports
* Implemented storage VM API (interop layer) + additional bug fixes when encountered.
* Bumped version 0.12.0
* fixed double point extension on compiled output file.
* Fixed bug where callExpr in returns where added to voidCall
* fixed binExpr compare equal
* Check the env for the gopath first
* removed travis.yml
* custom types + implemented general declarations.
* commented out the storage test to make the build pass
* refactor to use ast.Walk for recursive converting
* added lots of test cases
* added a new way to handle jump labels
* function calls with multiple arguments
* binary expression (LOR LAND)
* struct types + method receives
* cleaner opcode dumps, side by side diff for debugging test cases
* refactored tcp transport
* return errors on outgoing messages
* TCP transport should report its error after reading from connection
* handle error returned from peer transport
* bump version
* cleaned up error