neo-go/pkg/core
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
..
block *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
blockchainer rpc: add CalculateNetworkFee RPC method 2021-03-26 19:14:46 +03:00
chaindump block: drop Network from the Header 2021-03-26 13:45:18 +03:00
dao *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
fee core: add price for CALLT instruction 2021-06-07 19:17:22 +03:00
interop core: detalize errors during contract.LoadToken and contract.Call 2021-05-17 22:08:15 +03:00
mempool core: move mempool.Event to a separate package 2021-06-01 12:24:28 +03:00
mempoolevent core: move mempool.Event to a separate package 2021-06-01 12:24:28 +03:00
mpt mpt/tests: add compatibility tests 2021-06-04 11:09:17 +03:00
native core: do not allow NEP17 roundtrip in case of insufficient funds 2021-06-09 13:36:50 +03:00
state core: export (*NEOBalanceState).FromStackItem 2021-05-31 11:18:54 +03:00
stateroot stateroot: reject validated root if it doesn't match local one 2021-03-27 00:33:11 +03:00
storage *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
test_data change block/tx/extensible signing process, fix #1741 2021-03-12 11:27:50 +03:00
transaction config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
blockchain.go config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
blockchain_test.go *: fix whitespace errors 2021-05-12 22:51:41 +03:00
doc.go core: add Blockchain event subscription mechanism 2020-05-25 00:27:39 +03:00
helper_test.go core: do not allow NEP17 roundtrip in case of insufficient funds 2021-06-09 13:36:50 +03:00
interop_system.go core: remove neointerops-related files 2021-05-12 13:30:04 +03:00
interop_system_test.go *: remove dead code 2021-05-12 18:13:14 +03:00
interops.go core: simplify interop functions 2021-05-12 13:30:01 +03:00
interops_test.go dao: drop network from DAO 2021-03-26 13:45:18 +03:00
native_contract_test.go dao: drop network from DAO 2021-03-26 13:45:18 +03:00
native_designate_test.go *: fix whitespace errors 2021-05-12 22:51:41 +03:00
native_gas_test.go core: do not allow NEP17 roundtrip in case of insufficient funds 2021-06-09 13:36:50 +03:00
native_ledger_test.go *: upgrade tests to use T.Cleanup() 2021-03-01 17:08:00 +03:00
native_management_test.go *: fix whitespace errors 2021-05-12 22:51:41 +03:00
native_neo_test.go core: do not allow NEP17 roundtrip in case of insufficient funds 2021-06-09 13:36:50 +03:00
native_notary_test.go config: make MaxValidUntilBlockIncrement configurable 2021-05-17 13:43:03 +03:00
native_oracle_test.go block: drop Network from the Header 2021-03-26 13:45:18 +03:00
native_policy_test.go native: allow to set candidate register price 2021-03-11 10:12:30 +03:00
nonnative_name_service_test.go examples: fix IPv6 bounds check 2021-05-28 11:31:09 +03:00
notary_test.go *: fix all errcheck warnings in testing code 2021-05-12 21:45:12 +03:00
oracle_test.go oracle: make JSONPath compatible with C# implementation 2021-05-13 11:53:28 +03:00
prometheus.go stateroot: move state-root related logic to core/stateroot 2021-03-09 13:48:29 +03:00
stateroot_test.go core: fix ineffassign warning in test code 2021-05-12 19:37:14 +03:00
util.go *: remove dead code 2021-05-12 18:13:14 +03:00
util_test.go core: rename Neo.Crypto.CheckMultisig interop 2021-05-11 18:38:14 +03:00