nervosnetwork / ckb-cli

CKB command line interface
MIT License
55 stars 35 forks source link

Transaction generated by `ckb-cli deploy gen-txs` is rejected #575

Closed XuJiandong closed 3 months ago

XuJiandong commented 6 months ago

Rejected with following information:

[send cell transaction]: 0xe61b097a77057c116116e39a884c79ecd30046b1c90dca8437f68bff8c7da247
Send transaction error: jsonrpc error: `Server error: PoolRejectedTransactionByMinFeeRate: The min fee rate is 1000 shannons/KW, so the transaction fee should be 1591 shannons at least, but only got 1506

There is not enough fee after balancing:

https://github.com/nervosnetwork/ckb-cli/blob/c9d814defe063592ed9fdc7986b6fee5753cb462/src/subcommands/deploy/tx_builder.rs#L137

Increasing fee-rate to 1200 can solve this issue.

XuJiandong commented 6 months ago

It happens in multisig scenario. The delta is computed as 1591 - 1506, resulting in 85. Interestingly, this value aligns precisely with the combined size of a pubkey hash (20) and a signature (65). I am contemplating whether there could be an error in the witness calculation for multisig. See:

https://github.com/nervosnetwork/ckb-system-scripts/blob/a7b7c75662ed950c9bd024e15f83ce702a54996e/c/secp256k1_blake160_multisig_all.c#L26-L27

XuJiandong commented 4 months ago

Please find the attached info.json used in deployment with the transaction.

info.json.gz

The expected fee-rate is 1600 but actually it is lower than that.

EthanYuan commented 3 months ago

I simulated twice multisig contract(omnilock) deployments, one new deploy and one upgraded deploy, and both were successful at the default fee-rate of 1000.

ckb-cli version: v1.8.0-rc1