neo-go/pkg/core
Roman Khimov 1a48f1ce43 block: add PrimaryIndex to the stack item of block
This is a bad one.

$ ./bin/neo-go contract testinvokefunction -r https://rpc10.n3.nspcc.ru:10331 0xda65b600f7124ce6c79950c1772a36403104f2be getBlock 5762000
{
  "state": "HALT",
  "gasconsumed": "202812",
  "script": "AtDrVwARwB8MCGdldEJsb2NrDBS+8gQxQDYqd8FQmcfmTBL3ALZl2kFifVtS",
  "stack": [
    {
      "type": "Array",
      "value": [
        {
          "type": "ByteString",
          "value": "vq5IPTPEDRhz0JA4cQKIa6/o97pnJt/HfVkDRknd1rg="
        },
        {
          "type": "Integer",
          "value": "0"
        },
        {
          "type": "ByteString",
          "value": "zFYF3LGaTKdbqVX99shaBUzTq9YjXb0jaPMjk2jdSP4="
        },
        {
          "type": "ByteString",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        },
        {
          "type": "Integer",
          "value": "1722060076994"
        },
        {
          "type": "Integer",
          "value": "5293295626238767595"
        },
        {
          "type": "Integer",
          "value": "5762000"
        },
        {
          "type": "ByteString",
          "value": "LIt05Fpxhl/kXMX3EAGIASyOSQs="
        },
        {
          "type": "Integer",
          "value": "0"
        }
      ]
    }
  ],
  "exception": null,
  "notifications": []
}

$ ./bin/neo-go contract testinvokefunction -r http://seed3.neo.org:10332 0xda65b600f7124ce6c79950c1772a36403104f2be getBlock 5762000
{
  "state": "HALT",
  "gasconsumed": "202812",
  "script": "AtDrVwARwB8MCGdldEJsb2NrDBS+8gQxQDYqd8FQmcfmTBL3ALZl2kFifVtS",
  "stack": [
    {
      "type": "Array",
      "value": [
        {
          "type": "ByteString",
          "value": "vq5IPTPEDRhz0JA4cQKIa6/o97pnJt/HfVkDRknd1rg="
        },
        {
          "type": "Integer",
          "value": "0"
        },
        {
          "type": "ByteString",
          "value": "zFYF3LGaTKdbqVX99shaBUzTq9YjXb0jaPMjk2jdSP4="
        },
        {
          "type": "ByteString",
          "value": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
        },
        {
          "type": "Integer",
          "value": "1722060076994"
        },
        {
          "type": "Integer",
          "value": "5293295626238767595"
        },
        {
          "type": "Integer",
          "value": "5762000"
        },
        {
          "type": "Integer",
          "value": "6"
        },
        {
          "type": "ByteString",
          "value": "LIt05Fpxhl/kXMX3EAGIASyOSQs="
        },
        {
          "type": "Integer",
          "value": "0"
        }
      ]
    }
  ],
  "exception": null,
  "notifications": []
}

9 fields vs 10, notice the primary index right after the block number.

Back when ac527650eb initially added Ledger I've
used https://github.com/neo-project/neo/pull/2215 as a reference and it was
correct (no primary index). But then https://github.com/neo-project/neo/pull/2296
came into the C# codebase and while it looked like a pure refactoring it
actually did add the primary index as well and this wasn't noticed. It wasn't
noticed even when 3a4e0caeb8 had touched some
nearby code. In short, we had a completely wrong implementation of this call
for more than three years. But looks like it's not a very popular one.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2024-07-27 12:35:19 +03:00
..
block block: add PrimaryIndex to the stack item of block 2024-07-27 12:35:19 +03:00
chaindump chaindump: microoptimize memory management 2024-07-16 15:03:17 +03:00
dao dao: do not remove block executable by conflict record stub 2024-05-16 12:13:41 +03:00
fee vm: add ABORTMSG and ASSERTMSG opcodes 2023-08-10 12:41:30 +03:00
interop *: Convert slices to arrays instead of copy where possible 2024-07-05 20:36:22 +04:00
mempool *: replace go.uber.org/atomic with sync/atomic 2023-10-12 17:59:34 +03:00
mempoolevent *: replace interface{} with any keyword 2023-04-04 13:22:42 +03:00
mpt *: replace slice.Copy with bytes.Clone 2024-03-05 13:54:10 +03:00
native block: add PrimaryIndex to the stack item of block 2024-07-27 12:35:19 +03:00
state state: drop NativeContract, fix #3430 2024-05-16 18:46:46 +03:00
stateroot *: replace go.uber.org/atomic with sync/atomic 2023-10-12 17:59:34 +03:00
statesync *: replace slice.Copy with bytes.Clone 2024-03-05 13:54:10 +03:00
storage storage: bytes.Clone(nil) == nil 2024-05-16 19:29:11 +03:00
test_data core: refactor helper test contracts generation 2022-03-30 11:46:29 +03:00
transaction dao: fix transaction application log decoding 2024-05-16 12:13:41 +03:00
basic_chain_test.go config: add a special Blockchain type to configure Blockchain 2022-12-07 17:35:53 +03:00
bench_test.go core: make GetHeaderHash accept uint32 2022-11-25 14:30:51 +03:00
blockchain.go Merge pull request #3500 from nspcc-dev/optimize-ext-computations 2024-07-16 15:32:07 +03:00
blockchain_core_test.go core: introduce D hardfork 2024-06-05 19:20:04 +03:00
blockchain_neotest_test.go Merge pull request #3485 from nspcc-dev/test-maxstacksize 2024-06-11 19:04:26 +03:00
doc.go *: apply go 1.19 formatter heuristics 2022-08-09 15:37:52 +03:00
headerhashes.go *: use v2 LRU, fix #3322 2024-03-05 18:39:17 +03:00
helper_test.go *: add GenesisTransaction extension to the protocol configuration 2023-10-19 18:33:50 +03:00
interops.go core: add System.Runtime.CurrentSigners syscall 2023-11-20 14:46:27 +03:00
native_designate_test.go *: introduce Genesis protocol configuration 2023-10-19 18:30:20 +03:00
prometheus.go core: distinguish notarypool/mempool metrics 2023-04-13 18:40:19 +03:00
util.go *: add GenesisTransaction extension to the protocol configuration 2023-10-19 18:33:50 +03:00
util_test.go *: add GenesisTransaction extension to the protocol configuration 2023-10-19 18:33:50 +03:00