iotaledger / iota

Apache License 2.0
10 stars 4 forks source link

[Task (SC-Platform)]: Improve build-unsigned-checkpoint error with reused key #1279

Open Thoralf-M opened 4 months ago

Thoralf-M commented 4 months ago

Description

Using iota genesis-ceremony build-unsigned-checkpoint with a validator that has the same Ed25519 key as worker-key and network-key results in this panic:

thread 'main' panicked at crates/iota-genesis-builder/src/lib.rs:1137:62024-07-22T19:30:40.040286Z ERROR telemetry_subscribers: panicked at crates/iota-genesis-builder/src/lib.rs:1137:6:
Genesis creation should not fail here: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") }, function: 75, instruction: 0, function_name: Some("validate_metadata_bcs") }, 3), source: Some(VMError { major_status: ABORTED, sub_status: Some(3), message: None, exec_state: None, location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") }), indices: [], offsets: [(FunctionDefinitionIndex(75), 0)] }), command: Some(7) } }

Caused by:
    VMError with status ABORTED with sub status 3 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") } at code offset 0 in function definition 75 panic.file="crates/iota-genesis-builder/src/lib.rs" panic.line=1137 panic.column=6
:
Genesis creation should not fail here: ExecutionError: ExecutionError { inner: ExecutionErrorInner { kind: MoveAbort(MoveLocation { module: ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") }, function: 75, instruction: 0, function_name: Some("validate_metadata_bcs") }, 3), source: Some(VMError { major_status: ABORTED, sub_status: Some(3), message: None, exec_state: None, location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") }), indices: [], offsets: [(FunctionDefinitionIndex(75), 0)] }), command: Some(7) } }

Caused by:
    VMError with status ABORTED with sub status 3 at location Module ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("validator") } at code offset 0 in function definition 75

https://github.com/iotaledger/iota/blob/9cdfe10cf227f27662429abb68f94e1c7482aba0/crates/iota-framework/packages/iota-system/sources/validator.move#L44 which is not really helpful, as the key itself is totally fine (in this case), just also used as network-key

Steps to reproduce:

  1. iota genesis-ceremony init
  2. iota keytool generate bls12381
  3. iota keytool generate ed25519
  4. 
    iota genesis-ceremony add-validator \
    --name validator0 \
    --validator-key-file ./bls-0x7f9ca307a22d8ef380f1c702743e385baa1b01ba33a7e99f15ced59352e5a0a7.key \
    --worker-key-file ./0x6c58f5df3d6749863ebac6592b1e4320e73ca7785764c93af7ea9ad63b98ded4.key \
    --account-key-file ./0x6c58f5df3d6749863ebac6592b1e4320e73ca7785764c93af7ea9ad63b98ded4.key \
    --network-key-file ./0x6c58f5df3d6749863ebac6592b1e4320e73ca7785764c93af7ea9ad63b98ded4.key \
    --network-address /ip4/127.0.0.1/tcp/38189/http \
    --p2p-address /ip4/127.0.0.1/udp/34523 \
    --narwhal-primary-address /ip4/127.0.0.1/udp/38603 \
    --narwhal-worker-address /ip4/127.0.0.1/udp/36603 \
    --description "" \
    --image-url "" \
    --project-url ""```
    (with the `*.key` filenames from step 2 and 3)
  5. iota genesis-ceremony build-unsigned-checkpoint

Motivation

Improved UX

Requirements

  1. When a key is used as worker and network key, there should be a clear message that this is not allowed

Open questions (optional)

Should this be checked in the move code or on the Rust side? iota genesis-ceremony validate-state does not complain about this.

Are you planning to do it yourself in a pull request?

No.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.