Roman Khimov
93f51f922a
stackitem: return error in TryBytes() for big byte strings
...
Follow neo-project/neo-vm#349 .
2020-08-21 21:05:47 +03:00
Roman Khimov
a7670303e8
stackitem: change Bool() to TryBool(), prepare for its failures
2020-08-21 20:55:20 +03:00
Roman Khimov
eb8122837e
core: fix failing TestGetTransaction
...
3677cc0e2
ruined it:
TestGetTransaction: blockchain_test.go:413:
Error Trace: blockchain_test.go:413
Error: Not equal:
expected: 467
actual : 399
Test: TestGetTransaction
2020-08-19 13:22:31 +03:00
Roman Khimov
6dffd4967a
Merge pull request #1335 from nspcc-dev/tests/binary
...
Update binary test data
2020-08-19 11:33:47 +03:00
Evgenii Stratonikov
3677cc0e24
core: update GetTransaction test
2020-08-19 09:41:11 +03:00
Evgenii Stratonikov
04bff62d65
transaction: update binary test data
2020-08-18 15:09:30 +03:00
Evgenii Stratonikov
054b77dbde
block: update binary test data
2020-08-18 14:52:30 +03:00
Roman Khimov
52b002e079
Merge pull request #1332 from nspcc-dev/check-for-excessive-verification-results
...
core: verification script must return exactly one value
2020-08-18 12:15:10 +03:00
Anna Shaleva
591f639ad6
core: fix getOnPersistWrapper for native contracts
...
According to manifest, OnPersist.ReturnType is void, so we shouldn't
return anything from it. It's not so important, as we drop this value at
the end of OnPersist invocation.
2020-08-18 09:52:46 +03:00
Roman Khimov
d0c29f52c9
core: verification script must return exactly one value
...
C# node is quite picky as it expects there to be exactly one value returned,
but our testchain actually adds 4 signatures for multisig cases instead of 3
which makes it technically incompatible with C# node.
2020-08-17 22:02:15 +03:00
Roman Khimov
8e619cc671
Merge pull request #1318 from nspcc-dev/fix/verifytests
...
Add tests for `verifyTx` and `verifyHeader`
2020-08-14 17:24:03 +03:00
Roman Khimov
92f37a5d36
Merge pull request #1324 from nspcc-dev/fix-goreportcard-issues
...
Fix goreportcard issues
2020-08-14 14:50:35 +03:00
Evgenii Stratonikov
a796f2b61d
names: implement FromID
...
Allow to convert interop id to it's name.
2020-08-14 14:22:45 +03:00
Evgenii Stratonikov
7854dcfd8f
core: replace interop names with named constants
2020-08-14 14:21:54 +03:00
Evgenii Stratonikov
f3650e20b0
vm: move InteropNameToID to a separate package
2020-08-14 13:54:11 +03:00
Roman Khimov
e7d13e6db2
*: fix misspellings found in Go Report Card
2020-08-14 12:16:24 +03:00
Roman Khimov
f6a308f7f6
*: fix ineffassign where the value should really be used
...
Found with GoReportCard.
2020-08-14 12:08:57 +03:00
Roman Khimov
ec2a2f3fb9
transaction: fix ineffassign GoReportCard issue
...
s is not used purposefuly.
2020-08-14 12:08:16 +03:00
Evgenii Stratonikov
cadebdfc19
core: add tests for (*Blockchain).verifyHashAgainstScript
2020-08-14 09:40:36 +03:00
Evgenii Stratonikov
1eb9a4c6c6
core: allow to use verification contracts
...
In NEO3 we can't just appcall hash, as verification script has no access
to state. Instead we use `verify` method of an arbitrary contract.
2020-08-14 09:40:34 +03:00
Evgenii Stratonikov
7f2a931fb6
core: add tests for (*Blockchain).verifyHeader
2020-08-14 09:37:32 +03:00
Evgenii Stratonikov
e8cf4d96ce
core: add tests for (*Blockchain).verifyTx
2020-08-14 09:37:30 +03:00
Roman Khimov
ca542f11fe
core: drop unused secondsPerBlock() method
2020-08-11 21:37:18 +03:00
Roman Khimov
acc2265169
transaction: attribute type is now type, not usage
2020-08-11 21:10:50 +03:00
Roman Khimov
fb70c82157
transaction: there are no valid attributes defined for preview3
2020-08-11 21:10:12 +03:00
Roman Khimov
b1034d8ed6
state: drop Neo 2 Account and everything related
...
It's substituted with NEP5Balances now.
2020-08-11 20:42:02 +03:00
Roman Khimov
34156ef78d
core: fix (*HeaderHashList).Write comment
2020-08-11 20:33:16 +03:00
Roman Khimov
2354af463a
core: drop some unused HeaderHashList functions
2020-08-11 20:33:16 +03:00
Roman Khimov
08fd6180b2
native: drop validators count structure
...
It's not used since #1252 .
2020-08-11 20:19:55 +03:00
Roman Khimov
c3f7a419a0
Merge pull request #1296 from nspcc-dev/smartcontract/examples
...
examples: update examples
2020-08-11 19:09:13 +03:00
Anna Shaleva
b5494320f9
compiler, cli: support events from .yml config file
...
We currently can't process events in codegen, so we have to provide
them via .yml config file. Do not delete the rest of the code connected
with conversion of MethodDebugInfo.Event into manifest.Event as we have
issue #1038 .
2020-08-11 13:42:06 +03:00
Evgenii Stratonikov
057e1c6e3c
compiler: provide filename to Compile()
2020-08-11 11:10:45 +03:00
Roman Khimov
c16040aecc
native: sort GetValidators result
...
As it's returned sorted now. Fixes state change mismatch for
NextValidators. It also partially reverts
2f8e7e4d33
and significantly changes the test
chain as the fees are no longer being sent to the same account.
2020-08-10 19:49:09 +03:00
Roman Khimov
dba248236c
smartcontract: add CreateDefaultMultiSigRedeemScript
...
And use it where appropriate. Some of our code was just plain wrong (like the
one in GAS contract) and unification is always useful here.
2020-08-10 18:58:11 +03:00
Roman Khimov
fb97ea9458
native: don't register standby validators on initialization
...
C# doesn't do that since neo-project/neo#1762 .
2020-08-10 17:51:46 +03:00
Roman Khimov
f287681fa7
core/native: fix VotersCount zero value encoding
...
Empty byte array is enough to be bigint value of zero. Fixes state differences
with C# node.
2020-08-10 17:07:14 +03:00
Evgenii Stratonikov
bf01599430
vm: check return value on context unload
...
When calling external contracts we expect exactly 1 value to be on
stack. For methods returning nothing, `Null` value is pushed, otherwise
it is an error.`
2020-08-10 11:52:33 +03:00
Roman Khimov
4aeaf05f90
Merge pull request #1289 from nspcc-dev/fix/nep5
...
Port `getnep5transfers` changes to master
2020-08-10 11:11:24 +03:00
Evgenii Stratonikov
14aba7fc80
core: fix failing tests after merge
...
Related f5131491b
.
2020-08-10 09:20:34 +03:00
Roman Khimov
f5131491b7
Merge pull request #1271 from nspcc-dev/core/call_from_native
...
core: contractCall from native contracts
2020-08-07 21:24:50 +03:00
Anna Shaleva
c87e2262c3
core: remove ScriptHashGetter from interop context
...
We have VM inside the context, so don't need ScriptHashGetter anymore.
2020-08-07 20:31:20 +03:00
Anna Shaleva
42736095a1
core: add test to call contract from native
...
Closes #1200
2020-08-07 20:31:16 +03:00
Evgenii Stratonikov
807338f97e
core: do not store NEP5 transfer log in memory
...
Traversing transfer log instead of accumulating and returning it
is faster and takes less memory.
2020-08-07 18:21:06 +03:00
Anna Shaleva
995053f2eb
core: add VM into interop context
2020-08-07 16:15:24 +03:00
Roman Khimov
c3c88a57cd
Merge pull request #1281 from nspcc-dev/drop-go-1.12-and-fix-some-things
...
Drop go 1.12 and fix some things
2020-08-07 13:34:54 +03:00
Roman Khimov
d5a9d80c12
core: refactor out policy check for transaction
...
We were checking blocked accounts twice which is obviously excessive. We also
have our accounts sorted, so we can rely on that in CheckPolicy(). It also
doesn't make much sense to check MaxBlockSystemFee in Blockchain code, policy
contract can handle that.
2020-08-07 12:21:52 +03:00
Roman Khimov
90180c6fb6
native: pass DAO to CheckPolicy(), it doesn't need interop context
...
Simplify things a bit.
2020-08-07 12:21:52 +03:00
Roman Khimov
791c983304
core: drop GetScriptHashesForVerifying
...
It no longer depends on blockchain state and there can't ever be an error, in
fact we can always iterate over signers, so copying these hashes doesn't make
much sense at all as well as sorting arrays in verifyTxWitnesses (witnesses
order must match signers order).
2020-08-07 12:21:52 +03:00
Roman Khimov
c19838ea67
core: use errors.Is in PoolTx
...
Just in case.
2020-08-07 12:21:52 +03:00
Roman Khimov
4c38fae54c
core: fix mempool error check in PoolTx
...
ErrAlreadyExists should be returned for ErrDup, not ErrConflict.
2020-08-07 12:21:52 +03:00