Commit graph

188 commits

Author SHA1 Message Date
Anthony De Meulemeester
36b253872f WIP
Imported from CityOfZion/neo-storm (cbfc89972e977fa808e9f68c9ad5c6c18bef291d).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
a765561b3a implemented bitwise instructions and fixed loading constants of type uint (CityOfZion/neo-storm#49)
Imported from CityOfZion/neo-storm (b8a9b14dacc4fd6a62c236b2e89545684435a8fb).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
459d3654a2 fixed missing syscall transaction.GetHash() (CityOfZion/neo-storm#43)
Several bug fixes and improvements

Imported from CityOfZion/neo-storm (8e8fe5c215bfaed51452482f4f28cc9956a1f69b).
2019-08-14 19:14:07 +03:00
BlackTrace
69511e053f update right neo api (CityOfZion/neo-storm#40)
Imported from CityOfZion/neo-storm (eee635918c80a9444dc1b37e537f9ecaf1a83d33).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
0880e88fa5 Fixed bug in else stmts (CityOfZion/neo-storm#42)
* Fixed bug in else stmts

* Fixed if else bug

* Back to %v for formatting instructions

Imported from CityOfZion/neo-storm (ea8440e1454207753c8d209ce7c2cf724fd4ea16).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
b97e5aafec Fix/bugs (CityOfZion/neo-storm#38)
* 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).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
f547708e10 Implemented detailed init command (CityOfZion/neo-storm#37)
* Implemented detailed init command

* add command for skipping contract information

Imported from CityOfZion/neo-storm (0ef8b983ef43ef2eb8e9f190f1f36dc0e839bbc1).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
54a886a7fe Added docs folder with first draft of the runtime and smart contract API (CityOfZion/neo-storm#31)
* Added docs folder with first draft of the runtime and smart contract API

* Draft of the runtime/neo smart contract api

* Added more API documentation.

* Added the last API documentation for the NEO runtime and interop functions.

Imported from CityOfZion/neo-storm (bc7749ee08f2f48b87f13400e5917ee28e854d86).
2019-08-14 19:14:07 +03:00
Anthony De Meulemeester
55966c7e07 Draft of iterator and enumerator (CityOfZion/neo-storm#26)
* 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).
2019-08-14 19:14:06 +03:00
Ankur Srivastava
3fc25e1431 fixes CityOfZion/neo-storm#16
* A new command `cli init --name testcontract` now creates a directory testcontract/main.go

Imported from CityOfZion/neo-storm (331585e51ce13b6fe902b7a352b150c5b457a4f5).
2019-08-14 19:14:06 +03:00
Jeroen Peeters
df173c295d chore: change CompareBytes to EqualBytes (CityOfZion/neo-storm#22)
* chore: change CompareBytes to EqualBytes

* chore: remove trailing spaces

* chore: rename EqualBytes to Equals

Imported from CityOfZion/neo-storm (da16e967d9631e132488731a42966bccb5ad7f30).
2019-08-14 19:14:06 +03:00
Anthony De Meulemeester
f14833893c CityOfZion/neo-storm#17 Implemented util.CompareBytes (CityOfZion/neo-storm#21)
Imported from CityOfZion/neo-storm (c0ee185a7cfd2c222fb7b4c8ca19885844d53855).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
b997eeb051 fixed token example and fixed compiler test with multiple dirs (CityOfZion/neo-storm#20)
Imported from CityOfZion/neo-storm (2d0814a04c34f320dee41674066ccd766a7a8ea1).
2019-08-14 19:14:05 +03:00
Jeroen Peeters
1f8ccdba16 chore: move token example to nep5 as package name (CityOfZion/neo-storm#19)
* feat: add token example

* feat: code splitted package

* feat: use updated apis

* chore: change token namespace to nep5

* chore: add transfer event and readme updates

Imported from CityOfZion/neo-storm (63ec2d7dc23a60f128a8b383ceda1eaa15d919c1).
2019-08-14 19:14:05 +03:00
Jeroen Peeters
b3037cd598 Token Example (CityOfZion/neo-storm#12)
* feat: add token example

* feat: code splitted package

* feat: use updated apis

Imported from CityOfZion/neo-storm (e2bab450d7355b559ae2d70a87f557e8a6dbfff6).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
8bfaed0e4b added in the crypto helper api for smart contracts. (CityOfZion/neo-storm#15)
Imported from CityOfZion/neo-storm (ad6e9dae46846f97a7da6dd48bf55ad554d612b3).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
9e15ab04ce Added missing execution interop api (CityOfZion/neo-storm#14)
Imported from CityOfZion/neo-storm (ab12273da74e0d35df8863f08f1a914723d2bdba).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
0b33cf3193 new mapping for interop api (CityOfZion/neo-storm#10)
* new mapping for interop api

* Fixed interop API mapping + added missing apis

* added engine apis

Imported from CityOfZion/neo-storm (ec5e6c8e2b587704a1e071e83b633d2d3a235300).
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
2fbb269c0d added compiler to test all example files. (CityOfZion/neo-storm#9)
Imported from CityOfZion/neo-storm (e756a91b292f525f2cd7e6d6c05b46df582c8ece).
2019-08-14 19:14:05 +03:00
Roman Khimov
d804b517fc examples/token-sale: drop binary avm from the repo
It's easily reproduced from the token_sale.go and it's confusing the compiler
test.
2019-08-14 19:14:05 +03:00
Anthony De Meulemeester
05cd2775e2 renamed path to match the new project name (CityOfZion/neo-storm#8)
Imported from CityOfZion/neo-storm (d022d46cd851de78ee041851a80dc34e3b3b68d1).
2019-08-14 19:14:04 +03:00
Anthony De Meulemeester
523789ee1c Compiler interop APIs (CityOfZion/neo-storm#5)
* added draft of block and transaction interop api.

* added header interop API

* added attribute, transaction, input, output interop API

* Added asset, attribute and account interop api.

* added Runtime interop apis

* added asset renew and create + contract and asset interop apis

Imported from CityOfZion/neo-storm (b6810d58b98312a959980f344db24689839574c4).
2019-08-14 19:13:56 +03:00
Jeroen Peeters
e4c80a001c feat: add Log, Notify and Triggers
Imported from CityOfZion/neo-storm (5065465e39fd2b308c487f49f75f517620139660).
2019-08-14 18:59:34 +03:00
Jeroen Peeters
e6c16a6a24 chore: use shorthand in example
Imported from CityOfZion/neo-storm (a2f2da87fcfb1a4f8ccdb48a043f98ff47bb3e89).
2019-08-14 18:59:06 +03:00
Jeroen Peeters
29f05c0edb chore: move examples out of separate folder
Imported from CityOfZion/neo-storm (7eb644415d4083572c4e74590da056319c3a54fb).
2019-08-14 18:58:41 +03:00
Jeroen Peeters
90809ee73e chore: use Context interface
Imported from CityOfZion/neo-storm (16c6f9fab7de374196a4fb352d781abeebb384c1).
2019-08-14 18:58:04 +03:00
Jeroen Peeters
9d983ec77b feat: add storage APi's and example
Imported from CityOfZion/neo-storm (86ac5c215a2c6ec710f2fd913e0ace63d6ea993e).
2019-08-14 18:57:31 +03:00
Anthony De Meulemeester
86715511d0 Added examples folder
Imported from CityOfZion/neo-storm (77d0e5949470b2648acd37c71116f4469197772b).
2019-08-14 18:56:58 +03:00
Anthony De Meulemeester
1927bc54d5 added partial syscall mapping
Imported from CityOfZion/neo-storm (26d10c72f6e3d298135ec3995eb2d821640c3b7c).
2019-08-14 18:55:29 +03:00
Roman Khimov
33c512032f vm: switch from Opcode to Instruction
Which matches the changes done in neo-storm and also make this codebase closer
to the `dev` branch (that also uses Instruction).
2019-08-14 15:40:31 +03:00
Roman Khimov
5f3256d0e0 .gitignore: add *.(orig|rej) 2019-08-14 15:05:54 +03:00
Roman Khimov
db41a397cd
Merge pull request #120 from hal0x2328/master
Merging as a reminder as discussed in #283.
2019-08-12 15:41:48 +03:00
dauTT
095653af23 Implement rpc server method: sendrawtransaction (#174)
* 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
2019-03-20 12:30:05 +00:00
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
Anastasia Prasolova
a56511ced3 PublicKey from serialized bytes (#154)
* 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
2019-02-20 14:34:28 +01:00
Anastasia Prasolova
2fd2866f7f Key signature and wallet address get functions added to Public key (#144)
* 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
2019-02-19 18:37:35 +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