Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invokefunction and invokescript RPC calls should support scoped signatures #260

Closed
roman-khimov opened this issue Jun 10, 2020 · 2 comments

Comments

@roman-khimov
Copy link
Contributor

Summary or problem description
invokefunction and invokescript RPC calls support passing script hashes for verifying that are to be used by System.Runtime.CheckWitness syscall (thanks to neo-project/neo#335 and #214 changes). It's a very useful feature, but these hashes are not processed the way they will be processed when they're added as Cosigners for a transaction (and that's what is supposed to happen with a lot of these test invocations, trying first and then sending a real transaction) because transactions use scoped signatures since neo-project/neo#968 merge. It may affect the result of test invocation and lead to differences with execution on real network.

Do you have any solution you want to propose?
I propose replacing current script hashes parameter (which is just the last parameter for current invokefunction and invokescript that is supposed to be an array of hex-encoded 20-byte script hashes) with cosigners parameter that is to be represented as an array of JSON-serialized Cosigner structures (that are well-defined).

Example request using this format (similar to https://docs.neo.org/v3/docs/en-us/reference/rpc/latest-version/api/invokefunction.html):

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "invokefunction",
  "params": [
    "0x806b7fa0db3b46d6c42e1e1b0a7fd50db9d4a9b0",
    "transfer",
    [
      {
        "type": "Hash160",
        "value": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569"
      },
      {
        "type": "Hash160",
        "value": "0x2916eba24e652fa006f3e5eb8f9892d2c3b00399"
      },
      {
        "type": "Integer",
        "value": "1000"
      }
    ],
    [
      {
        "account": "0xcadb3dc2faa3ef14a13b619c9a43124755aa2569",
        "scopes": "CalledByEntry"
      }
    ]
  ]
}

Where in the software does this update applies to?

  • RPC (HTTP)
@roman-khimov
Copy link
Contributor Author

Side note: we have it now implemented as an extension in neo-go, so it accepts both an array of hashes (that are treated like cosigners with Global scope) and an array of proper Cosigners.

@superboyiii
Copy link
Member

@roman-khimov #280 was merged, your issue should be solved.

@shargon shargon closed this as completed Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants