rooch-network / rooch

VApp Container with Move Language for Bitcoin ecosystem
https://rooch.network
Apache License 2.0
162 stars 85 forks source link

Server panic #2550

Closed pause125 closed 2 months ago

pause125 commented 2 months ago

Rooch version

rooch 0.6.9 (git commit d551c377f51113c9a77d906989083b5d7ddc4955)

What did you do?

  1. start a local server
  2. Open a new terminal, run rooch move publish -p frameworks/moveos-stdlib/ --sender-account 0x2

What did you see happen?

  1. On client side, you will see message:

    INCLUDING DEPENDENCY MoveStdlib
    BUILDING MoveosStdlib
    Publish modules to address: 0000000000000000000000000000000000000000000000000000000000000002
    Error: client error (Connect)
  2. On server side, you will see message:

    ......
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    2024-08-31T14:18:05.159249Z ERROR rooch_rpc_server: Panic occurred:
    panicked at moveos/moveos/src/moveos.rs:295:18:
    system_pre_execute should not fail.: VMError { major_status: ABORTED, sub_status: Some(1), message: Some("0x0000000000000000000000000000000000000000000000000000000000000003::account::create_account at offset 6"), exec_state: Some(ExecutionState { stack_trace: [(Some(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("transaction_validator") }), FunctionDefinitionIndex(1), 7)] }), location: Module(ModuleId { address: 0000000000000000000000000000000000000000000000000000000000000003, name: Identifier("account") }), indices: [], offsets: [(FunctionDefinitionIndex(0), 6)] } 
    exit the process

What did you expect to see?

The server side should not panic. And client side should output error message about that no private key to sign for account 0x2

pause125 commented 2 months ago

The cause of this bug is: after the client creates a transaction using the system reserved address as the sender, rooch_framework::transaction_validator::pre_execute attempts to create an account for this address, resulting in MoveVM abort. On the Rust side, if MoveOS fails to execute rooch_framework::transaction_validator::pre_execute, panic occurs.