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

[Bug Report]wrong prompt when deploying package with secret-file belongs to another address #3703

Closed
JerryKwan opened this issue Aug 31, 2022 · 4 comments · Fixed by #3722
Closed
Labels
bug Something isn't working

Comments

@JerryKwan
Copy link
Contributor

Bug Report

Starcoin version:

V1.12.3

Current behavior:
deploy the package(0x9941a1ba299db38d9b46f5be2d557781) with secret file which belongs to another address (0xfb989d0cc7eb1b24cebb83cc344a79c3), the prompt is something like

Use package address (0x9941a1ba299db38d9b46f5be2d557781) as transaction sender
txn dry run result:
The deployment is successfull.

but in fact build_and_execute_transaction result is something like

ExecuteResultView { raw_txn: RawUserTransactionView { sender: 0x9941a1ba299db38d9b46f5be2d557781, sequence_number: StrView(1), payload: StrView([1, 153, 65, 161, 186, 41, 157, 179, 141, 155, 70, 245, 190, 45, 85, 119, 129, 1, 155, 2, 161, 28, 235, 11, 4, 0, 0, 0, 9, 1, 0, 4, 2, 4, 4, 3, 8, 25, 5, 33, 12, 7, 45, 78, 8, 123, 32, 10, 155, 1, 5, 12, 160, 1, 81, 13, 241, 1, 2, 0, 0, 1, 1, 0, 2, 12, 0, 0, 3, 0, 1, 0, 0, 4, 2, 1, 0, 0, 5, 0, 1, 0, 0, 6, 2, 1, 0, 1, 8, 0, 4, 0, 1, 6, 12, 0, 1, 12, 1, 7, 8, 0, 1, 5, 9, 77, 121, 67, 111, 117, 110, 116, 101, 114, 6, 83, 105, 103, 110, 101, 114, 7, 67, 111, 117, 110, 116, 101, 114, 4, 105, 110, 99, 114, 12, 105, 110, 99, 114, 95, 99, 111, 117, 110, 116, 101, 114, 4, 105, 110, 105, 116, 12, 105, 110, 105, 116, 95, 99, 111, 117, 110, 116, 101, 114, 5, 118, 97, 108, 117, 101, 10, 97, 100, 100, 114, 101, 115, 115, 95, 111, 102, 153, 65, 161, 186, 41, 157, 179, 141, 155, 70, 245, 190, 45, 85, 119, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 1, 7, 3, 0, 1, 0, 1, 0, 3, 13, 11, 0, 17, 4, 42, 0, 12, 1, 10, 1, 16, 0, 20, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22, 11, 1, 15, 0, 21, 2, 1, 2, 0, 1, 0, 1, 3, 14, 0, 17, 0, 2, 2, 1, 0, 0, 1, 5, 11, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 45, 0, 2, 3, 2, 0, 0, 1, 3, 14, 0, 17, 2, 2, 0, 0, 0, 0]), decoded_payload: Some(Package(DecodedPackageView { package_address: 0x9941a1ba299db38d9b46f5be2d557781, modules: [StrView([161, 28, 235, 11, 4, 0, 0, 0, 9, 1, 0, 4, 2, 4, 4, 3, 8, 25, 5, 33, 12, 7, 45, 78, 8, 123, 32, 10, 155, 1, 5, 12, 160, 1, 81, 13, 241, 1, 2, 0, 0, 1, 1, 0, 2, 12, 0, 0, 3, 0, 1, 0, 0, 4, 2, 1, 0, 0, 5, 0, 1, 0, 0, 6, 2, 1, 0, 1, 8, 0, 4, 0, 1, 6, 12, 0, 1, 12, 1, 7, 8, 0, 1, 5, 9, 77, 121, 67, 111, 117, 110, 116, 101, 114, 6, 83, 105, 103, 110, 101, 114, 7, 67, 111, 117, 110, 116, 101, 114, 4, 105, 110, 99, 114, 12, 105, 110, 99, 114, 95, 99, 111, 117, 110, 116, 101, 114, 4, 105, 110, 105, 116, 12, 105, 110, 105, 116, 95, 99, 111, 117, 110, 116, 101, 114, 5, 118, 97, 108, 117, 101, 10, 97, 100, 100, 114, 101, 115, 115, 95, 111, 102, 153, 65, 161, 186, 41, 157, 179, 141, 155, 70, 245, 190, 45, 85, 119, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 2, 1, 7, 3, 0, 1, 0, 1, 0, 3, 13, 11, 0, 17, 4, 42, 0, 12, 1, 10, 1, 16, 0, 20, 6, 1, 0, 0, 0, 0, 0, 0, 0, 22, 11, 1, 15, 0, 21, 2, 1, 2, 0, 1, 0, 1, 3, 14, 0, 17, 0, 2, 2, 1, 0, 0, 1, 5, 11, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 45, 0, 2, 3, 2, 0, 0, 1, 3, 14, 0, 17, 2, 2, 0, 0, 0])], init_script: None })), max_gas_amount: StrView(10000000), gas_unit_price: StrView(1), gas_token_code: "0x1::STC::STC", expiration_timestamp_secs: StrView(3643), chain_id: 254 }, raw_txn_hex: "0x9941a1ba299db38d9b46f5be2d5577810100000000000000019941a1ba299db38d9b46f5be2d557781019b02a11ceb0b040000000901000402040403081905210c072d4e087b200a9b01050ca001510df101020000010100020c000003000100000402010000050001000006020100010800040001060c00010c010708000105094d79436f756e746572065369676e657207436f756e74657204696e63720c696e63725f636f756e74657204696e69740c696e69745f636f756e7465720576616c75650a616464726573735f6f669941a1ba299db38d9b46f5be2d5577810000000000000000000000000000000100020107030001000100030d0b0011042a000c010a01100014060100000000000000160b010f001502010200010001030e001100020201000001050b0006000000000000000012002d00020302000001030e0011020200000000809698000000000001000000000000000d3078313a3a5354433a3a5354433b0e000000000000fe", dry_run_output: DryRunOutputView { explained_status: ERROR { status_code: "INVALID_AUTH_KEY" }, txn_output: TransactionOutputView { status: Discard { status_code: StrView(2), status_code_name: "INVALID_AUTH_KEY" }, gas_used: StrView(0), write_set: [], events: [] } }, execute_output: None }

Expected behavior:

  1. check if sender address and package address match
  2. fail fast
  3. show detailed error message to facilitate debugging

Steps to reproduce:

Related code:

https://github.com/starcoinorg/starcoin/blob/master/cmd/starcoin/src/cli_state.rs#L290
https://github.com/starcoinorg/starcoin/blob/master/vm/move-package-manager/src/deployment.rs#L105

Other information:

@JerryKwan JerryKwan added the bug Something isn't working label Aug 31, 2022
@JerryKwan
Copy link
Contributor Author

It can be confirmed the package did not deployed to another address by using the command followed

starcoin% account execute-function --function 0x9941a1ba299db38d9b46f5be2d557781::MyCounter::init_counter -s 0xfb989d0cc7eb1b24cebb83cc344a79c3 -b
{
  "err": "Module ModuleId { address: 0x9941a1ba299db38d9b46f5be2d557781, name: Identifier(\"MyCounter\") } can't be found"
}

@jolestar
Copy link
Member

jolestar commented Sep 1, 2022

1 we need support to deploy to another address when the target address's upgrade strategy is the two-phase upgrade.
2 and 3 are ok.

@JerryKwan
Copy link
Contributor Author

@jolestar Is there any test case about the two-phase upgrade you described?
It would be better to consider security with operation convenience in mind

@jolestar
Copy link
Member

jolestar commented Sep 1, 2022

@jolestar Is there any test case about the two-phase upgrade you described? It would be better to consider security with operation convenience in mind

https://github.com/starcoinorg/starcoin/blob/master/executor/tests/module_upgrade_test.rs#L1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants