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

Non-asset signer in invokefunction should not be able to create tx automatically and should not be in the list of signers. #370

Closed
superboyiii opened this issue Oct 12, 2020 · 0 comments

Comments

@superboyiii
Copy link
Member

superboyiii commented Oct 12, 2020

sender is who pay the fee, signers is who sign that this transaction it's ok. because sender must be a signer, we decided to use the first entry for it.

If designed like this ,then we should modify here, because what we input is not what we get. I use a non-asset address to be the signer, it doesn't return insufficient balance but automatically choose another address as signer which will make people confused.
image

{
  "jsonrpc": "2.0",
  "method": "invokefunction",
  "params": [
    "0x254b9decd76080ef368e7a6b0a065938dfbc31cf",
    "balanceOf",
    [
      {
        "type": "Hash160",
        "value": "0xf642a0401fdd56a03114639a98b7963eb587a30a"
      }
    ],
    [
      {
        "account": "0xef9b39f97b13be48a48ee1bbdd4c9b35024778ca",
        "scopes": "CalledByEntry"
      }
    ]
  ],
  "id": 3
}
{
    "jsonrpc": "2.0",
    "id": 3,
    "result": {
        "script": "0c140aa387b53e96b7989a631431a056dd1f40a042f611c00c0962616c616e63654f660c14cf31bcdf3859060a6b7a8e36ef8060d7ec9d4b2541627d5b52",
        "state": "HALT",
        "gasconsumed": "3840690",
        "stack": [
            {
                "type": "Integer",
                "value": "2000000000000000"
            }
        ],
        "tx": "001e3fa04eb29a3a0000000000a4e2230000000000ea162000020aa387b53e96b7989a631431a056dd1f40a042f600ca784702359b4cddbbe18ea448be137bf9399bef01003e0c140aa387b53e96b7989a631431a056dd1f40a042f611c00c0962616c616e63654f660c14cf31bcdf3859060a6b7a8e36ef8060d7ec9d4b2541627d5b5202420c40f01f3b9890929d86af6ee3aa0bf8089e5097d9a9acc506067e546aa3ccbca61508122c44f8e6a4e92974e21fde3f92e5c60555b5b050e7fab5a63ce99cbe00bc290c2103cea3e2f81f1af93522d29ede4f24a1f0bedead7293391d33880f5475d97878c90b4195440d78420c40df98a383c5858f11826f7edb765881ddc9d8c0583aef9221368f88a56308c21250f0bb4dfacb5012b9bd87dd8270fadfc474b86d4dd5ec308d15c11c2c0c5429290c21029e86bfd7666b1e11105ed7f427758b4bcde8db6d5e7c8eb3aea1316abfcd6b3a0b4195440d78"
    }
}
{
  "jsonrpc": "2.0",
  "method": "sendrawtransaction",
  "params": ["001e3fa04eb29a3a0000000000a4e2230000000000ea162000020aa387b53e96b7989a631431a056dd1f40a042f600ca784702359b4cddbbe18ea448be137bf9399bef01003e0c140aa387b53e96b7989a631431a056dd1f40a042f611c00c0962616c616e63654f660c14cf31bcdf3859060a6b7a8e36ef8060d7ec9d4b2541627d5b5202420c40f01f3b9890929d86af6ee3aa0bf8089e5097d9a9acc506067e546aa3ccbca61508122c44f8e6a4e92974e21fde3f92e5c60555b5b050e7fab5a63ce99cbe00bc290c2103cea3e2f81f1af93522d29ede4f24a1f0bedead7293391d33880f5475d97878c90b4195440d78420c40df98a383c5858f11826f7edb765881ddc9d8c0583aef9221368f88a56308c21250f0bb4dfacb5012b9bd87dd8270fadfc474b86d4dd5ec308d15c11c2c0c5429290c21029e86bfd7666b1e11105ed7f427758b4bcde8db6d5e7c8eb3aea1316abfcd6b3a0b4195440d78"],
  "id": 1
}
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "hash": "0x7b3c8ae059ba7cd18d98cedcf8bb3c455ca4668921500274ea4e600be00bdc29"
    }
}
{
  "jsonrpc": "2.0",
  "method": "getrawtransaction",
  "params": ["0x7b3c8ae059ba7cd18d98cedcf8bb3c455ca4668921500274ea4e600be00bdc29", 1],
  "id": 1
}
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "hash": "0x7b3c8ae059ba7cd18d98cedcf8bb3c455ca4668921500274ea4e600be00bdc29",
        "size": 351,
        "version": 0,
        "nonce": 1319124766,
        "sender": "NLtDqwnj9s7wQVyaiD5ohjV3e9fUVkZxDp",
        "sysfee": "3840690",
        "netfee": "2351780",
        "validuntilblock": 2103018,
        "signers": [
            {
                "account": "0xf642a0401fdd56a03114639a98b7963eb587a30a",
                "scopes": "None"
            },
            {
                "account": "0xef9b39f97b13be48a48ee1bbdd4c9b35024778ca",
                "scopes": "CalledByEntry"
            }
        ],
        "attributes": [],
        "script": "DBQKo4e1Ppa3mJpjFDGgVt0fQKBC9hHADAliYWxhbmNlT2YMFM8xvN84WQYKa3qONu+AYNfsnUslQWJ9W1I=",
        "witnesses": [
            {
                "invocation": "DEDwHzuYkJKdhq9u46oL+AieUJfZqazFBgZ+VGqjzLymFQgSLET45qTpKXTiH94/kuXGBVW1sFDn+rWmPOmcvgC8",
                "verification": "DCEDzqPi+B8a+TUi0p7eTySh8L7erXKTOR0ziA9Uddl4eMkLQZVEDXg="
            },
            {
                "invocation": "DEDfmKODxYWPEYJvftt2WIHdydjAWDrvkiE2j4ilYwjCElDwu036y1ASub2H3YJw+t/EdLhtTdXsMI0VwRwsDFQp",
                "verification": "DCECnoa/12ZrHhEQXtf0J3WLS83o221efI6zrqExar/NazoLQZVEDXg="
            }
        ],
        "blockhash": "0x79e4f4084102e63dcb39153114137312660a556689080596f6a931ed04ab45c6",
        "confirmations": 3,
        "blocktime": 1602312595703,
        "vmstate": "HALT"
    }
}

We should modify it in MakeTransaction of wallet.cs, but can't influence other method which need automatically Tx creation.
Originally posted by @superboyiii in #351 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant