neo-go/pkg/core/native
Anna Shaleva be902afe9e core: do not allow NEP17 roundtrip in case of insufficient funds
NEP17 roundtrip is prohibited if from account doesn't have enough funds.

This commit fixes states diff in block 92057 where account
NfuwpaQ1A2xaeVbxWe8FRtaRgaMa8yF3YM initiates two NEO roundtrips with
amount exceeding the account's balance:

block 92057: value mismatch for key +////xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQMhAkwBIQOZZwEA vs QQMhAkwBIQN/ZwEA
block 92057: value mismatch for key +v///ws=: kqlddcitCg== vs tphddcitCg==
block 92057: value mismatch for key +v///xTbYWBH3r5qhRKZAPFPHabKfb2vhQ==: QQEhBUWyDu0W vs QQEhBWmhDu0W

C#'s applog (contains False and False on stack for both transfers):
```
{
   "id" : 1,
   "jsonrpc" : "2.0",
   "result" : {
      "executions" : [
         {
            "gasconsumed" : "11955500",
            "exception" : null,
            "stack" : [
               {
                  "value" : false,
                  "type" : "Boolean"
               },
               {
                  "value" : false,
                  "type" : "Boolean"
               }
            ],
            "vmstate" : "HALT",
            "trigger" : "Application",
            "notifications" : []
         }
      ],
      "txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
   }
}
```

Go's applog (both transfers succeeded and GAS minted):
```
{
   "result" : {
      "executions" : [
         {
            "gasconsumed" : "11955500",
            "trigger" : "Application",
            "stack" : [
               {
                  "type" : "Boolean",
                  "value" : true
               },
               {
                  "type" : "Boolean",
                  "value" : true
               }
            ],
            "vmstate" : "HALT",
            "notifications" : [
               {
                  "eventname" : "Transfer",
                  "contract" : "0xd2a4cff31913016155e38e474a2c06d08be276cf",
                  "state" : {
                     "value" : [
                        {
                           "type" : "Any"
                        },
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "value" : "4316",
                           "type" : "Integer"
                        }
                     ],
                     "type" : "Array"
                  }
               },
               {
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "type" : "ByteString",
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U="
                        },
                        {
                           "type" : "Integer",
                           "value" : "1111111111"
                        }
                     ]
                  },
                  "contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
                  "eventname" : "Transfer"
               },
               {
                  "contract" : "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
                  "state" : {
                     "type" : "Array",
                     "value" : [
                        {
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U=",
                           "type" : "ByteString"
                        },
                        {
                           "type" : "ByteString",
                           "value" : "22FgR96+aoUSmQDxTx2myn29r4U="
                        },
                        {
                           "type" : "Integer",
                           "value" : "1111111"
                        }
                     ]
                  },
                  "eventname" : "Transfer"
               }
            ]
         }
      ],
      "txid" : "0x8e73a7e9a566a514813907272ad65fc965002c3b098eacc5bdda529af19d7688"
   },
   "id" : 1,
   "jsonrpc" : "2.0"
}
```
2021-06-09 13:36:50 +03:00
..
nativenames core: remove native NNS 2021-05-17 22:22:07 +03:00
nativeprices core: move NotaryVerificationPrice to a separate package 2021-03-23 13:56:39 +03:00
noderoles core: move native node roles to a separate pkg 2021-03-23 13:56:34 +03:00
compatibility_test.go config: add NativeUpdateHistory 2021-03-15 12:35:14 +03:00
contract.go core: remove native NNS 2021-05-17 22:22:07 +03:00
crypto.go native: implement CryptoLib contract 2021-03-10 19:24:19 +03:00
crypto_test.go core: use Neo.Crypto.CheckSig for standard signature verification 2021-03-10 21:45:58 +03:00
designate.go native: emit Designation event on role update 2021-04-29 14:12:48 +03:00
doc.go *: add more package-specific documentation 2021-03-19 16:18:45 +03:00
interop.go config: add NativeUpdateHistory 2021-03-15 12:35:14 +03:00
ledger.go *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
management.go *: fix whitespace errors 2021-05-12 22:51:41 +03:00
management_test.go *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +03:00
native_gas.go native: add refuel method to GAS contract 2021-04-29 18:26:34 +03:00
native_neo.go native/neo: add getAccountState method, close #1975 2021-05-27 10:59:38 +03:00
native_neo_candidate.go stackitem: change Bool() to TryBool(), prepare for its failures 2020-08-21 20:55:20 +03:00
native_neo_test.go native: implement delegated voting 2020-08-06 20:39:13 +03:00
native_nep17.go core: do not allow NEP17 roundtrip in case of insufficient funds 2021-06-09 13:36:50 +03:00
nativenames_test.go *: fix some misspellings spotted by GoReportCard 2021-03-22 12:13:08 +03:00
neo_types.go native: cache committee together with votes 2020-11-10 15:23:06 +03:00
notary.go config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
oracle.go *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
oracle_types.go native: move OracleRequest to state package 2020-10-08 13:48:14 +03:00
oracle_types_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
policy.go *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
std.go native/std: add base58Check* methods, close #1974 2021-05-25 17:32:19 +03:00
std_test.go native/std: add base58Check* methods, close #1974 2021-05-25 17:32:19 +03:00
util.go *: fix whitespace errors 2021-05-12 22:51:41 +03:00