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

EOS setcode and setabi error #396

Open
leocll opened this issue Jun 26, 2019 · 9 comments
Open

EOS setcode and setabi error #396

leocll opened this issue Jun 26, 2019 · 9 comments

Comments

@leocll
Copy link

leocll commented Jun 26, 2019

Successful with ScatterWebExtension, error with ScatterDesktop.
This mistake has been bothering me all day. I saw other issues about it, but none of them solved the problem. Help me, I will be grateful.

  • Net config
const network = Network.fromJson({
    blockchain:'eos',
    host:'api-kylin.eoslaomao.com',
    port:443,
    protocol:'https',
    chainId:'5fff1dae8dc8e2fc4d5b23b2c7665c97f9e9d8edf2b6485a86ba311c25639191' // <-- this is the 麒麟测试
});
  • Code
const options = { authorization:[`${this.account.name}@${this.account.authority}`] };
const completed = res => { console.log(res) }
const abi_ = {
      "____comment": "This file was generated with eosio-abigen. DO NOT EDIT ",
      "version": "eosio::abi/1.1",
      "types": [],
      "structs": [{"name": "hi","base": "","fields": [{"name": "user", "type": "name"}]}],
      "actions": [{"name": "hi","type": "hi","ricardian_contract": ""}],
      "tables": [],
      "ricardian_clauses": [],
      "variants": []
    }
eos.setabi(this.account.name, abi_, options)
        .then(completed).catch(completed)
// eos.contract('eosio.token').then(contract => {
//         contract.transfer(this.account.name, "leoclltest12", '1.0000 EOS', "ceshi", options)
//             .then(completed).catch(completed);
//     })
  • Error
{
    "code":500,
    "message":"Internal Service Error",
    "error":{
        "code":3090003,
        "name":"unsatisfied_authorization",
        "what":"Provided keys, permissions, and delays do not satisfy declared authorizations",
        "details":[
            {
                "message":"transaction declares authority '{"actor":"leoclltest14","permission":"active"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], provided keys ["EOS5ZcMvpgtDMdVtvCFewAQYTyfN6Vqhg4kdgauffx3jiaKaeWfY1"], and a delay max limit of 3888000000 ms",
                "file":"authorization_manager.cpp",
                "line_number":524,
                "method":"check_authorization"
            }
        ]
    }
}
@leocll
Copy link
Author

leocll commented Jun 26, 2019

The transfer can be successful, but setcode and setabi will report the error.

// transfer, successful
eos.contract('eosio.token').then(contract => {
        contract.transfer(this.account.name, "leoclltest12", '1.0000 EOS', "ceshi", options)
            .then(completed).catch(completed)
    })
// setabi, error
eos.setabi(this.account.name, abi_, options)
        .then(completed).catch(completed)
// setabi, error
eos.contract('eosio').then(contract => {
        contract.setabi(this.account.name, "0e656f73696f3a3a6162692f312e31000102686900010475736572046e616d6501000000000000806b02686900000000", options)
            .then(completed).catch(completed)
    })

@leocll leocll changed the title ScatterDesktop setcode and setabi error EOS setcode and setabi error Jun 27, 2019
@nsjames
Copy link
Contributor

nsjames commented Jul 1, 2019

5ed9936 fixed here, staged for next patch (11.0.1)

@leocll
Copy link
Author

leocll commented Jul 2, 2019

I used ScatterDesktop for 11.0.1 and this problem still exists.T_T

@nsjames
Copy link
Contributor

nsjames commented Jul 2, 2019

Don't use the release version. Build from master, as the fix only exists there. The prerelease does not have it.

@leocll
Copy link
Author

leocll commented Jul 3, 2019

I have built from master, but there is a new error "No Identity". I am still waiting for you to release a new version.

@leocll
Copy link
Author

leocll commented Jul 11, 2019

You only fixed setabi, forgot the setcode. @nsjames

@leocll
Copy link
Author

leocll commented Jul 11, 2019

I hope you can fix it as soon as possible. This is very important to my project. I will be very grateful. @nsjames

@leocll
Copy link
Author

leocll commented Jul 16, 2019

There is still a problem with setcode

scatter.eos code

// error
eos = this.scatter.eos(network, Eos, {chainId: network.chainId, expireInSeconds: 60});
eos.setcode(this.account.name, 0, 0, this.hexCharCodeToStr(code), options)
.then(completed).catch(completed)

error

"{"code":500,"message":"Internal Service Error","error":{"code":3090003,"name":"unsatisfied_authorization","what":"Provided keys, permissions, and delays do not satisfy declared authorizations","details":[{"message":"transaction declares authority '{\"actor\":\"leoclltest14\",\"permission\":\"active\"}', but does not have signatures for it under a provided delay of 0 ms, provided permissions [], provided keys [\"EOS5JaQ2qpWnsL5W6KoUooTaEU73SWY49gw5pA6jNLVzFuAJp4EsN\"], and a delay max limit of 3888000000 ms","file":"authorization_manager.cpp","line_number":524,"method":"check_authorization"}]}}"

eos code

// success
eos = Eos(config);
eos.setcode(this.account.name, 0, 0, this.hexCharCodeToStr(code), options)
.then(completed).catch(completed)

Complete Code
@nsjames

@nsjames
Copy link
Contributor

nsjames commented Jul 16, 2019

Hmm. Wonder why it didn't work for both.
Scatter's core code (including all eosjs parsing internally) is undergoing a huge extrapolation right now and it's likely these issues won't exist after it's done.

This will have to wait for next release though which has to go through a testing phase.

You can track the progress on these:
https://github.com/GetScatter/ScatterCore
https://github.com/GetScatter/ScatterDesktop/tree/core-extrapolation

@nsjames nsjames reopened this Jul 16, 2019
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

2 participants