Commit graph

832 commits

Author SHA1 Message Date
Evgeniy Kulikov
a5e85d69de Replace assertion for rpc/server_test.go (#156)
fix #155
fix circle-ci
2019-02-22 08:47:02 +01:00
dauTT
19201dcf52 Implemented rpc server method GetRawTransaction (#135)
* 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
2019-02-20 18:39:32 +01:00
Evgeniy Kulikov
20bb05b335 Fix #140 (improve error message) (#142)
- return errors like in C# code (neo-project/neo#587)
- update tests
- small refactoring
2019-02-20 16:28:11 +00:00
Evgeniy Kulikov
cdba88b9f2 Code refactoring (#143)
- simplify code
- prealoc slices
- check errors in tests
- regexp Compile replaced with MustCompile
- uint* cannot be negative
2019-02-19 14:22:33 +01:00
Evgeniy Kulikov
9c24bf9139 Blockchain graceful shutdown (#139)
* Blockchain graceful shutdown

- fix #138
- stop blockchain goroutine
- close leveldb database

* fix possible context leak (go vet)
2019-02-19 12:48:48 +01:00
Evgeniy Kulikov
c0a5c100ca Fix API documentation link (#141) 2019-02-19 12:48:02 +01:00
57cb289bcd make State a set as in reference C# implementation (#123)
* make State a set as in reference C# implementation

* fix issues
2019-02-19 12:47:25 +01:00
Evgeniy Kulikov
001a0e601e Add RPC Server method ValidateAddress (#134)
* Add RPC Server method ValidateAddress

- implement rpc method validateaddress (https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html)
- add tests
- add to README.md

* revert go.sum

* remove break

* more tests and C# errors

* simplify

* fix after master merge
2019-02-13 18:18:47 +00:00
Evgeniy Kulikov
763452fe33 Fix #130: Wrong answer for RPC server method getaccountstate (#131)
* 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)
2019-02-13 18:01:52 +00:00
Evgeniy Kulikov
67cbcac643 Fix typos (#133)
* Fix typos

* revert chains/unit_testnet

* revert chains

* fix review comments (thx @AlexVanin)
2019-02-13 18:01:10 +00:00
Evgeniy Kulikov
845d719698 Fix possible data race (#136)
- 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
2019-02-12 20:03:21 +01:00
Evgeniy Kulikov
630919bf7d Fix typos and warnings for GoReport / GolangCiLinter (#132)
- typos
- gofmt -s
- govet warnings
- golangci-lint run
2019-02-09 16:53:58 +01:00
Anastasia Prasolova
d183ea3c1f BalanceGetter interface shortened (#127)
* small fixes

* gofmt

* fix in raw tx build

* fixes after review

* balance getter interface
2019-02-08 16:32:01 +01:00
dauTT
7e43717657 Implemented rcp method GetAccountState (#124)
* 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
2019-02-08 09:04:38 +01:00
Anastasia Prasolova
a5e2df6942 small fix of utxo calculation on raw transaction build (#126)
* small fixes

* gofmt

* fix in raw tx build

* fixes after review
2019-02-07 12:44:51 +01:00
Anastasia Prasolova
a058598ecc Parse stack params (#119)
* small fixes

* gofmt

* bytearray parsing

* tests

* removed unnecessary files

* added more types for bytearray

* iter

* made TryParseArray parameter variadic

* fixes after review

* fix after review

* misprints

* updated array reverse

* imports/fmt

* naming
2019-02-05 13:22:10 +01:00
Evgeniy Kulikov
7c1147f04f [FIX] http/Transport.Dial is deprecated (#125)
---

cc @anthdm / @fyrchik / @aprasolova / @AlexVanin / @decentralisedkev
2019-02-05 09:29:39 +01:00
Evgeniy Kulikov
f000b76879 [FIX] Formatting and code-style (#118)
* [FIX] Formatting and code-style

- gofmt
- import resort
- prealloc slices
- simplify code

* fix vet
2019-01-25 12:20:35 +01:00
df2e9f68ef Add StackParam JSON Unmarshaler (#116) 2019-01-22 13:15:04 +01:00
dauTT
1360e1de68 Added rpc unit tests (#107)
* 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'
2019-01-22 13:14:52 +01:00
Anastasia Prasolova
77296f6481 Small fixes (#117)
* small fixes

* gofmt
2019-01-22 13:14:40 +01:00
Anastasia Prasolova
74f0019df2 SendToAddress RPC call (#114)
* 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
2018-12-21 10:32:18 +01:00
dauTT
e2f42e92a0 Implemented rcp method GetAssetState (#103)
* Fix missing dot in configPath

* Add rpc GetAssetState method

* Update rpc README.md

* Update version to 0.45.10
2018-11-26 22:12:33 +01:00
aprasolova
de45c58551 RPC invocation parameters (#106)
* added rpc.invoke and parameters marshalling

* removed debug output

* stringer and marshalling corrections

* version
2018-11-26 16:57:53 +01:00
Evgeniy Kulikov
6ccb518ab0 Optimizations + some improvements (#105)
* Optimizations + some improvements

- optimized pkg/core/storage.HeaderHashes
- optimized pkg/rpc.performRequest (used json.Encoder)
- fixes for pkg/util.ReadVarUint and pkg/util.WriteVarUint
- optimized and fix fixed8 (Fixed8DecodeString / MarshalJSON) + tests
- optimized and fix uint160 (Bytes / Uint160DecodeString / Equal / MarshalJSON) + tests
- optimized and fix uint256 (Bytes / Equal / MarshalJSON) + tests
- preallocate for pkg/vm.buildStackOutput
- add go.mod / go.sum

* update version
2018-11-26 16:56:45 +01:00
4bd4635e49 add rpc.GetRawTransaction() method (#87) 2018-06-27 07:48:39 +02:00
f69451d36d Add Error fields to RPC responses (#84)
Also add `Script` field to `InvokeResult` structure.
2018-05-13 20:32:45 +02:00
Steven Jack
0b023c5c5c Small RPC improvements (#57)
* 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
2018-03-30 08:15:03 +02:00
Anthony De Meulemeester
34bd9d31ac
Compiler arrays (#49)
* 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.
2018-03-25 18:21:00 +02:00
Steven Jack
ad9333c74c Bug where result was written after error regardless of if there was one or not (#54)
* Fix bug where result was sent back aswell as error

* Bumps version
2018-03-25 12:13:47 +02:00
Steven Jack
19a430b262 RCP server (#50)
* 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
2018-03-23 21:36:59 +01:00
Anthony De Meulemeester
b2a5e34aac
RPC client (#42)
* 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.
2018-03-05 09:53:09 +01:00