polkadot-fellows / runtimes

The various runtimes which make up the core subsystems of networks for which the Fellowship is represented.
GNU General Public License v3.0
139 stars 94 forks source link

Fund various System Chains sovereign accounts used by the P<>K bridge #238

Closed acatangiu closed 6 months ago

acatangiu commented 7 months ago

For the Polkadot <> Kusama bridge to operate and support DOT/KSM transfer between Polkadot AssetHub and Kusama AssetHub we need to fund following accounts:

Note: all of these accounts are exclusively chain-owned (governance-owned)

On Polkadot BridgeHub

On Kusama BridgeHub

acatangiu commented 7 months ago

Actually sovereign accounts of AHP on AHK and vice-versa are no longer needed/used - checking.

Yes, not needed, removed from description.

acatangiu commented 7 months ago

Proposed amounts

Based on fees distribution documented in https://github.com/paritytech/parity-bridges-common/issues/2871, we will initially fund:

Polkadot BH accounts total: 10_100 DOT, Kusama BH accounts total: 2_030 KSM,

which should provide enough coverage for at least 5000 messages each way - in the meantime we'll continue working on an automated mechanism to move user paid fees to these accounts, and not require manual/governance rebalancing.

Proposed amounts per account

On Polkadot BridgeHub

Total: 10_100 DOT

On Kusama BridgeHub

Total: 2_030 KSM

acatangiu commented 7 months ago

Options for funding:

  1. Treasury track (small spender) proposals to fund these accounts independently.
  2. Treasury track (small spender) to fund a fellow account then they will split and forward the full sum according to the split described above (multiple XCM transfers done manually).
  3. Whitelisted caller track to dispatch (as treasury) multiple XCM transfers straight to the final BH accounts described above.

Afaict, option 1 is not possible from the main relay chain treasury as it can't do cross-chain payouts.

Option 3 should work fine but I expect it to take a 1-2 weeks at best, delaying bridge operation.

In the interest of time I will go for Option 2 and act as the middleman, if small spender referendum is rejected, I will fallback on option 3.

acatangiu commented 7 months ago

I have created following funding referendums:


L.E. removed preimages for above referendums, they will fail even if they pass, we are going with Option 3 instead (see below)

acatangiu commented 7 months ago

Falling back to whitelisted caller (Option 3) instead of manual middleman transfer (Option 2).

Calls to whitelist and run:

on Polkadot relay

0x1a0300016d6f646c70792f747273727900000000000000000000000000000000000000001a020c630903000100a90f03000101007369626ce8030000000000000000000000000000000000000000000000000000030400000000070010a5d4e80000000000630903000100a90f0300010100627261700000000162686b7300726577617264732d6163636f756e74000000000304000000000b00203d88792d0000000000630903000100a90f0300010100627261700000000162686b7301726577617264732d6163636f756e74000000000304000000000b00203d88792d0000000000

on Kusama relay

0x180300016d6f646c70792f7472737279000000000000000000000000000000000000000018020c630903000100a90f03000101007369626ce80300000000000000000000000000000000000000000000000000000304000000000b00e057eb481b0000000000630903000100a90f030001010062726170000000016268706400726577617264732d6163636f756e74000000000304000000000f0080c6a47e8d030000000000630903000100a90f030001010062726170000000016268706401726577617264732d6163636f756e74000000000304000000000f0080c6a47e8d030000000000

These do utility::dispatchAs(Signed(TREASURY), utility::batchAll( 3x limitedTeleportAssets )

franciscoaguirre commented 7 months ago

Checking the calls, there's no need to calculate the sovereign account and transfer to AccountId32 { id: calculated_sov_account, _ }, you can just put the location of the chain as the beneficiary and it will calculate the sovereign account for you.

So instead of using the calculated account, you could put { parents: 1, interior: [Parachain(1000)].into() } to deposit to the sovereign account of asset hub, for example.

Now that I checked, the other sovereign accounts are something that we don't have a Location for. The best way in my mind would be to have a location for them, a converter from location to account id, and then the message would be so much cleaner. I agree that now that we don't have it let's just use those accounts. I'd still change AssetHub's though.

franciscoaguirre commented 7 months ago

Regarding the amounts in those calls:

Unless I got something wrong. I checked Polkadot has 10 decimals and Kusama 12.

You should show the public key of the accounts here as well as the SS58 address because it's the public key that shows up in the decoded XCMs.

acatangiu commented 7 months ago

Done, see updated comment: https://github.com/polkadot-fellows/runtimes/issues/238#issuecomment-2007179202

bkontur commented 7 months ago

just a nit - one more 0x here:

0x0x7369626ce8030000000000000000000000000000000000000000000000000000
  0x7369626ce8030000000000000000000000000000000000000000000000000000
franciscoaguirre commented 7 months ago

Also, the accounts of the lanes are the same, is that expected?

acatangiu commented 7 months ago

Also, the accounts of the lanes are the same, is that expected?

There is a digit difference (0 vs 1) if you look carefully (or run it through a diff) coming from the encoding of an inner enum - making the difference between the two accounts.

serban300 commented 7 months ago

Executed the calls in chopsticks. Results:

Polkadot BridgeHub:

Account 13cKp89SgdtqUngo2WiEijPrQWdHFhzYZLf2TJePKRvExk7o
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 999,964,070,000
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Account 13E5fui93Uyua5RtDv2LQj4aVBBHo6YREe3n6CBwYdqNqoxj
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 49,999,964,070,000
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Account 13E5fui93Uyua5RtDv2c9kcAbfrVFeeHyJzHe8sn1Ti77Afd
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 49,999,964,070,000
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Kusama BridgeHub

Account FBeL7EFTDeHnuViqaUHUXvhhUusN5FawDmHgfvzF97DXFr3
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 29,999,880,233,333
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Account EoQBtnwp4jMtCEpV7C88rKrz6x1qMBh2z74ibGSqtZRnuMM
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 999,999,880,233,333
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Account EoQBtnwp4jMtCEpV7CPsssT6bdDHuHZmf3aGXxHJiSA4Dz3
system.account: FrameSystemAccountInfo
{
  nonce: 0
  consumers: 0
  providers: 1
  sufficients: 0
  data: {
    free: 999,999,880,233,333
    reserved: 0
    frozen: 0
    flags: 170,141,183,460,469,231,731,687,303,715,884,105,728
  }
}

Seems correct

acatangiu commented 7 months ago

~Need Rank3+ fellow to submit whitelist proposal~ DONE

For Polkadot

Referendum https://polkadot.polkassembly.io/referenda/593 which will execute call in preimage.

On Polkadot Collectives chain: I've submitted preimage to whitelist above call

https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x3d003e02029368c5073d0ed5ed2bf755c526a4d358cef8a2cecf387c76eb276608ce44655f35000000010a000000

For Kusama

Referendum https://kusama.polkassembly.io/referenda/361 which will execute call in preimage.

I've also submitted preimage to whitelist above call

L.E. Done by @kianenigma 🙏

acatangiu commented 6 months ago

Kusama side executed, Kusama BH accounts successfully funded 🎉

acatangiu commented 6 months ago

Polkadot also executed, accounts successfully funded. Closing issue.