neo-go/pkg/core/native
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
..
native_test block: add PrimaryIndex to the stack item of block 2024-07-27 12:35:19 +03:00
nativehashes native: autogenerate nativehashes package 2024-05-14 09:39:53 +03:00
nativenames core: add nativenames.All list 2024-04-25 13:26:54 +03:00
nativeprices core: move NotaryVerificationPrice to a separate package 2021-03-23 13:56:39 +03:00
noderoles *: introduce Genesis protocol configuration 2023-10-19 18:30:20 +03:00
compatibility_test.go native: implement HF-based update 2024-04-25 13:16:42 +03:00
contract.go core: move P2PNotary node role out of P2PSigExtensions 2024-05-21 12:10:47 +03:00
contract_test.go native: implement HF-based update 2024-04-25 13:16:42 +03:00
crypto.go native: bind CryptoLib's verifyWithECDsa changes to Cockatrice 2024-05-17 15:52:00 +03:00
crypto_blspoints.go native: fix error message on unexpected BLS12-381 curve point 2023-10-05 13:46:05 +03:00
crypto_test.go native: adjust NamedCurveHash values 2024-05-13 10:10:56 +03:00
designate.go core: move P2PNotary node role out of P2PSigExtensions 2024-05-21 12:10:47 +03:00
doc.go *: add more package-specific documentation 2021-03-19 16:18:45 +03:00
interop.go native: implement HF-based update 2024-04-25 13:16:42 +03:00
invocation_test.go *: move NativeUpdateHistory logic under Hardforks management 2023-11-21 14:05:28 +03:00
ledger.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
management.go native: perform initialisation for the set of hardforks 2024-05-17 15:58:02 +03:00
management_neotest_test.go native: test immediate contract availability 2023-11-30 15:58:00 +03:00
management_test.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
native_gas.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
native_neo.go native: bind Neo's CommitteeChanged event to Cockatrice 2024-05-17 15:22:29 +03:00
native_neo_candidate.go [#2442] English Check 2022-05-04 19:48:27 +03:00
native_neo_test.go stackitem: introduce Convertible interface 2021-07-19 15:42:42 +03:00
native_nep17.go native: support native method/event removal 2024-05-17 15:22:26 +03:00
nativenames_test.go [#2442] English Check 2022-05-04 19:48:27 +03:00
neo_types.go native: add committee change events 2024-03-19 23:00:06 +03:00
notary.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
oracle.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
oracle_types.go [#2442] English Check 2022-05-04 19:48:27 +03:00
oracle_types_test.go *: replace interface{} with any keyword 2023-04-04 13:22:42 +03:00
policy.go native: fix Policy's IsBlocked behaviour 2024-05-17 12:33:51 +03:00
policy_test.go core: move Policy contract tests to native 2022-06-08 22:44:25 +03:00
std.go native: make Oracle service handle native Oracle updates 2024-04-25 13:26:54 +03:00
std_test.go core, interop: add strLen method for native StdLib contract 2023-11-20 19:23:33 +03:00
util.go bigint: don't allocate in ToPreallocatedBytes 2022-06-02 15:38:39 +03:00