Giter Site home page Giter Site logo

Comments (5)

roman-khimov avatar roman-khimov commented on August 14, 2024 1

I need to use the actual signers; otherwise, the check witness calls will fail. If it fails, the system fee will be incorrect.

These are different fees and nothing prevents you from using one set of signers for system fee calculation and the other for network fee calculation.

from neo-go.

roman-khimov avatar roman-khimov commented on August 14, 2024

Your transaction is:

{
      "Version": 0,
      "Nonce": 2514125905,
      "SystemFee": 0,
      "NetworkFee": 0,
      "ValidUntilBlock": 107,
      "Script": "DAR0ZXN0AGQMFA2pZ6QAQyvyf46OtG/orGWezN4EDBRt/ZapzGBDT9YILYp1q1ufMj9X9BTAHwwIdHJhbnNmZXIMFM924ovQBixKR47jVWEBExnzz6TSQWJ9W1I=",
      "Attributes": [],
      "Signers": [
           {
                "account": "0x04decc9e65ace86fb48e8e7ff22b4300a467a90d",
                "scopes": "CalledByEntry"
           },
           {
                "account": "0xf4573f329f5bab758a2d08d64f4360cca996fd6d",
                "scopes": "CalledByEntry"
           }
      ],
      "Scripts": [
           {
                "invocation": "DEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "verification": "DCEDWpKPIBY5IE4GtDaLGpM2VGKo67/wuIGBUbdPqrOithpBVuezJw=="
           },
           {
                "invocation": "DEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
                "verification": "DCEDWpKPIBY5IE4GtDaLGpM2VGKo67/wuIGBUbdPqrOithpBVuezJw=="
           }
      ],
      "Trimmed": false
 }

So you have two signers here. Then you pass two witnesses with this verification code:

INDEX    OPCODE       PARAMETER
0        PUSHDATA1    035a928f201639204e06b4368b1a93365462a8ebbff0b8818151b74faab3a2b61a    <<
35       SYSCALL      System.Crypto.CheckSig (56e7b327)

Which hashes down to 0x04decc9e65ace86fb48e8e7ff22b4300a467a90d. This is the hash of the first signer, but the second one is different, that's why you get an error:

{"id":1,"jsonrpc":"2.0","error":{"code":-508,"message":"Invalid signature","data":"witness hash mismatch"}}

And it's a valid one, if you're to take the network fee data, stuff it into your transaction, sign and try to send it --- it'd be invalid. To make it a valid one you need a proper script for the second signer, if you're to provide that NeoGo will happily calculate the network fee. Right now it can't, it doesn't have a script for 0xf4573f329f5bab758a2d08d64f4360cca996fd6d signer (which btw, can be anything, not just a simple signature, but we don't know).

NOBUG.

from neo-go.

lock9 avatar lock9 commented on August 14, 2024

Hi @roman-khimov,

We don't have access to the verification script, so we are using a placeholder. To produce a valid verification script, we would need the public key. It looks like C# parses it as a 'placeholder'. I understand that this is not ideal: it always calculates the fees using a 'single-sig account,' whereas, in practice, it could be a multi-sig.

The main issue is that the application works with C# nodes but not with Neo Go nodes. This inconsistency causes it to work for some users and not for others. If the signer is not present, could it be considered a default single-signature account? (mimic c#)

from neo-go.

roman-khimov avatar roman-khimov commented on August 14, 2024

We don't have access to the verification script, so we are using a placeholder

But you have to get a proper verification script and put it into transaction. You just have to do this before calculatenetworkfee and not after that. Otherwise you can stub the signer account as well (use a random key and account), it'll work fine for fee calculation.

The main issue is that the application works with C# nodes but not with Neo Go nodes.

neo-project/neo#2805 will be implemented eventually and I expect C# nodes to get this behavior as well.

from neo-go.

lock9 avatar lock9 commented on August 14, 2024

Hello,
Thank you for the super fast response.

I need to use the actual signers; otherwise, the check witness calls will fail. If it fails, the system fee will be incorrect.

EDIT: I get it now. We can use the stub to calculate the network fee. It won't affect the system fee because it's calculated using a test invoke

from neo-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.