Roman Khimov
a4294f4b5f
core: export UtilityTokenID and GoverningTokenID
...
Both are very useful outside of the core, this change also makes respective
transactions initialize with the package as they don't depend on any kind of
input and it makes no sense recreating them again and again on every use.
2020-02-19 12:13:27 +03:00
Evgenii Stratonikov
9b82bbaa8a
rpc: implement getstorage RPC
2020-02-18 11:59:31 +03:00
Evgenii Stratonikov
a2f012e589
core: deploy new smart-contract in test blocks
...
Also put smart-contract sources in testdata and
add invocation TX with APPCALL and storage.Put.
2020-02-18 11:59:28 +03:00
Anna Shaleva
2b9e63c511
core: add func to generate RPC test data
...
newRPCTestChain function generates test chain "testblocks.acc" for RPC
tests
2020-02-17 23:54:25 +03:00
Anna Shaleva
c99b42f738
rpc: add tests for getcontractstate RPC
2020-02-17 23:54:25 +03:00
Anna Shaleva
3c63ef3dc3
rpc: implement getcontractstate RPC
2020-02-17 23:54:25 +03:00
Anna Shaleva
b8715ddf11
rpc: refactor code of NewAccountState function
...
Simplified reversing of scriptHash
2020-02-17 23:52:20 +03:00
Anna Shaleva
f310145612
rpc: fix getrawtransaction error returncode
...
Changed returncode of getrowtransaction method in case when transaction
with specified hash does not exists. Now it returns error with code -100
instead of -32602 (as in c# node)
2020-02-17 23:52:20 +03:00
Anna Shaleva
5dca765bd1
rpc: add custom error with code -100
...
Fixed getassetstate method: it should return error with code -100 when
asset with specified id is not found (as in c# node).
2020-02-17 23:52:20 +03:00
Evgenii Stratonikov
7ee10ecea5
rpc: implement gettxout RPC
2020-02-17 11:58:18 +03:00
Evgeniy Kulikov
64e325d9af
Update tests for getblock
action
...
- replace `GetBlockResponse.Result` with `wrappers.Block`
- update `getblock` checker and add more assets
2020-02-12 21:58:43 +03:00
Evgeniy Kulikov
41ebf12eb3
Update getblock
RPC action response
2020-02-12 19:43:51 +03:00
Evgenii Stratonikov
8243a8b3a7
emit: use io.BinWriter instead of bytes.Buffer
2020-02-06 18:45:37 +03:00
Evgenii Stratonikov
4d8a3a359b
vm: move Emit* functions to a separate package
...
Also strip 'Emit' prefix because 'emit' is now
in the package name.
2020-02-06 18:45:37 +03:00
Roman Khimov
b1b660c779
rpc: fix getaccountstate/getunspents for unknown addresses
...
Returning error string as a result (not an error) is utterly wrong, but C#
implementation just returns a zero balance for unknown addresses, so we should
follow that.
2020-01-29 19:01:00 +03:00
Evgenii Stratonikov
54e0b5a4a7
rpc: set MaxGasInvoke in config
...
Implement ability to restrict maximum amount of GAS
available for free RPC calls.
2020-01-22 14:31:57 +03:00
Evgenii Stratonikov
4718375db1
rpc: return amount of consumed GAS in invoke*
2020-01-22 14:31:57 +03:00
Roman Khimov
ea3b76ded1
network: make NewServer return an error, fix #612
...
It can return nil in two cases, so we're better return an error and handle
it.
2020-01-22 11:17:51 +03:00
Roman Khimov
32213b1454
Merge pull request #601 from nspcc-dev/refactoring/core
...
core: refactor out Block, BlockBase and Header, closes #597 .
2020-01-20 16:19:20 +03:00
Roman Khimov
46b82b4fb5
keys: don't return error from PrivateKey.Sign
...
As it can't ever happen.
2020-01-17 17:00:30 +03:00
Evgenii Stratonikov
489b88afbb
block: rename BlockBase to Base
2020-01-16 10:16:24 +03:00
Evgenii Stratonikov
63c56cca5c
core: refactor out Block, BlockBase and Header structs
...
See #597 .
2020-01-16 10:16:24 +03:00
Roman Khimov
b5f234ddef
rpc: make rpc request logging at Debug level
...
Makes no sense polluting logs with Info. It also affects benchmarking.
2020-01-13 17:33:29 +03:00
Evgenii Stratonikov
9dc5571327
core,rpc: close Blockchain in tests
...
If blockchain is not closed, logging in defer can occur
after test has finished, which will lead to a panic with
"Log in goroutine after Test* has completed".
2020-01-10 11:47:56 +03:00
Evgenii Stratonikov
45a4524054
rpc: remove EnableCORSWorkaround from Request
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
289cb1c1d9
rpc: use zap.Logger
2020-01-10 11:14:29 +03:00
Evgenii Stratonikov
aecdf470e7
cli,pkg: use zap.Logger
2020-01-10 11:14:27 +03:00
Roman Khimov
9145855d2c
Merge pull request #579 from nspcc-dev/refactor-crypto
...
This moves some functionality into micro-packages, improves testing,
unexports some code and fixes bugs along the way.
2019-12-25 18:12:50 +03:00
Roman Khimov
b246653f62
address: rename functions as per #579 comments
...
Make them more clear to understand.
2019-12-25 17:34:18 +03:00
Roman Khimov
e685e9bf9a
address: move into its own package
...
Doesn't really belong to the crypto.
2019-12-25 15:22:02 +03:00
Vsevolod Brekelov
606616618f
rpc: add ability to answer as C# with block as []byte
2019-12-25 01:44:37 +03:00
Evgenii Stratonikov
884779e501
*: goimports
2019-12-17 14:51:28 +03:00
Roman Khimov
54d888ba70
io: add type-specific read/write methods
...
This seriously improves the serialization/deserialization performance for
several reasons:
* no time spent in `binary` reflection
* no memory allocations being made on every read/write
* uses fast ReadBytes everywhere it's appropriate
It also makes Fixed8 Serializable just for convenience.
2019-12-12 20:19:50 +03:00
Vsevolod Brekelov
2d42b14a1d
core: renames entities-> state and removed State prefix
2019-12-11 13:14:18 +03:00
Vsevolod Brekelov
ec17654986
core: refactoring blockchain state and storage
...
add dao which takes care about all CRUD operations on storage
remove blockchain state since everything is stored on change
remove storage operations from structs(entities)
move structs to entities package
2019-12-11 13:05:31 +03:00
Roman Khimov
7e371588a7
core/tx: remove one layer of indirection for scripts and inouts
...
It reduces heap pressure a little for these elements as we don't have to
allocate/free them individually. And they're directly tied to transactions or
block, not being shared or anything like that, so it makes little sense for
them to be pointer-based. It only makes building transactions a little easier,
but that's obviously a minor usecase.
2019-12-09 17:14:10 +03:00
Roman Khimov
3898aadcec
rpc: simplify uint160 handling
...
Use new Uint160DecodeStringLE() function.
2019-12-06 19:47:58 +03:00
Evgenii Stratonikov
7179e4ba9f
util: add LE suffix to Uint256 methods
2019-12-06 12:16:55 +03:00
Evgenii Stratonikov
57efad912c
util: add LE suffix to Uint160 methods
2019-12-06 12:16:55 +03:00
Roman Khimov
141d27795e
rpc: remove hardcoded pushbytes64 constant
...
Using our new and shiny opcode package.
2019-12-03 18:23:46 +03:00
Roman Khimov
138e125646
*: remove duplicate functions producing verification script
...
Drop wif.GetVerificationScript(), drop
smartcontract.CreateSignatureRedeemScript(), add GetVerificationScript()
directly to the PublicKey and use it everywhere.
2019-12-03 18:23:46 +03:00
Roman Khimov
8d4dd2d2e1
vm: move opcodes into their own package
...
This allows easier reuse of opcodes and in some cases allows to eliminate
dependencies on the whole vm package, like in compiler that only needs opcodes
and doesn't care about VM for any other purpose.
And yes, they're opcodes because an instruction is a whole thing with
operands, that's what context.Next() returns.
2019-12-03 18:22:14 +03:00
Roman Khimov
bc5beb438f
*: gofmt
...
Somehow these crept into the repository.
2019-12-02 10:10:50 +03:00
Roman Khimov
dccf440dca
rpc: skip input/outputs mangling if no gas is attached to invocation
2019-11-29 18:00:08 +03:00
Roman Khimov
8a5ac12df8
rpc: make generic SignAndPushInvocationTx out of DeployContract
...
SignAndPushInvocationTx() is gonna be used for more than just deploying
contracts.
2019-11-29 17:59:07 +03:00
Roman Khimov
127f8418c8
rpc: refactor out runScriptInVM() from invokers
2019-11-28 19:13:58 +03:00
Roman Khimov
e216139108
rpc: implement server-side 'invoke' method, fix #346
2019-11-28 19:08:31 +03:00
Roman Khimov
d04bc0cbe3
rpc: add marshaler for StackParamType
...
Makes stack output look better, no one cares about numbers.
2019-11-27 13:00:11 +03:00
Roman Khimov
3843451ec4
rpc: fix potential getblock handling problem, add a test for it
...
It should only accept hex strings and numbers, anything else is wrong.
2019-11-27 13:00:11 +03:00
Roman Khimov
1c883cc819
rpc: add invokescript tests
2019-11-27 13:00:11 +03:00