axonweb3 / axon

Axon is a Layer 2 framework of CKB with native cross-chain and interoperability.
https://axonweb3.io
MIT License
65 stars 39 forks source link

fix(cli): Fix peer id generation #1656

Closed distributedstatemachine closed 6 months ago

distributedstatemachine commented 6 months ago

What this PR does / why we need it?

This PR fixes a bug in the key generation , where peer_id is hex encoded.

What is the impact of this PR?

Before

/axon$ ./target/release/axon generate-keypair -n 1 -p .
{
  "keypairs": [
    {
      "index": 0,
      "net_private_key": "0x3e7ee435ec780adc22913cf43dcf81849596e66436d6ea92473b5aa38ce59355",
      "public_key": "0x02817154cbb0946980b352378b7366fc86dff6ca5f71a3c3767accd4d35481aa16",
      "address": "0x1F781E1FA61dce22A256873Af1E4066D6f2Db042",
      "peer_id": "0x516d5475796e324b445a66685271665763666f79656a424e53737554414b75567432616a6e4d6331524858664737",
      "bls_private_key": "0x72e19bff8b6a260ff33c57fede34d3ff5cad1891f48674db952413f45324da07",
      "bls_public_key": "0x9688b98d4c203d42e0d73b7bd233c5e73b5a92804fc7ac5446ee80d9758d0da9f6250fea030377a697e29059c0e98f29"
    }
  ]
}

After

 ./target/release/axon generate-keypair -n 1 -p . | grep peer_id
      "peer_id": "QmS93dMohH8pvvV9ULSGSX7YmPuEbx7gr29Qfyfp1Ch5KA",

No Breaking Change

PR relation:

CI Settings
### **CI Usage** **Tip**: Check the CI you want to run below, and then comment `/run-ci`. **CI Switch** - [ ] Web3 Compatible Tests - [ ] OpenZeppelin tests - [ ] v3 Core Tests ### **CI Description** | CI Name | Description | | ---------------------- | ------------------------------------------------------------------------------------------------------- | | *Web3 Compatible Test* | Test the Web3 compatibility of Axon | | *v3 Core Test* | Run the compatibility tests provided by Uniswap V3 | | *OpenZeppelin tests* | Run the compatibility tests provided by OpenZeppelin, including OCT 1-5 \| 6-10 \| 11 \| 12-15 \| 16-19 |