Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
3 of 6 tasks
acatangiu opened this issue Mar 14, 2024 · 15 comments
Closed
3 of 6 tasks

Comments

@acatangiu
Copy link
Contributor

acatangiu commented Mar 14, 2024

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

  • SA of Polkadot asset hub to pay for the execution of ExportMessage: 13cKp89SgdtqUngo2WiEijPrQWdHFhzYZLf2TJePKRvExk7o
Generated using:
frame_support::sp_runtime::AccountId32::new( SiblingParachainConvertsVia::::convert_location(&Location { parents: 1, interior: [Parachain(1000)].into() }).unwrap() ).to_ss58check_with_version(0_u16.into())
  • SA of lane dedicated to asset hub for paying rewards for delivery: 13E5fui93Uyua5RtDv2LQj4aVBBHo6YREe3n6CBwYdqNqoxj
Generated using:
frame_support::sp_runtime::AccountId32::new( PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new( LaneId([0, 0, 0, 1]), *b"bhks", RewardsAccountOwner::ThisChain )) ) .to_ss58check_with_version(0_u16.into())
  • SA of lane dedicated to asset hub for paying rewards for delivery confirmation: 13E5fui93Uyua5RtDv2c9kcAbfrVFeeHyJzHe8sn1Ti77Afd
Generated using:
frame_support::sp_runtime::AccountId32::new( PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new( LaneId([0, 0, 0, 1]), *b"bhks", RewardsAccountOwner::BridgedChain )) ) .to_ss58check_with_version(0_u16.into())

On Kusama BridgeHub

  • SA of Kusama asset hub to pay for the execution of ExportMessage: FBeL7EFTDeHnuViqaUHUXvhhUusN5FawDmHgfvzF97DXFr3
Generated using:
frame_support::sp_runtime::AccountId32::new( SiblingParachainConvertsVia::::convert_location(&Location { parents: 1, interior: [Parachain(1000)].into() }).unwrap() ).to_ss58check_with_version(2_u16.into())
  • SA of lane dedicated to asset hub for paying rewards for delivery: EoQBtnwp4jMtCEpV7C88rKrz6x1qMBh2z74ibGSqtZRnuMM
Generated using:
frame_support::sp_runtime::AccountId32::new( PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new( LaneId([0, 0, 0, 1]), *b"bhpd", RewardsAccountOwner::ThisChain )) ) .to_ss58check_with_version(2_u16.into())
  • SA of lane dedicated to asset hub for paying rewards for delivery confirmation: EoQBtnwp4jMtCEpV7CPsssT6bdDHuHZmf3aGXxHJiSA4Dz3
Generated using:
frame_support::sp_runtime::AccountId32::new( PayRewardFromAccount::<[u8; 32], [u8; 32]>::rewards_account(RewardsAccountParams::new( LaneId([0, 0, 0, 1]), *b"bhpd", RewardsAccountOwner::BridgedChain )) ) .to_ss58check_with_version(2_u16.into())
@acatangiu
Copy link
Contributor Author

acatangiu commented Mar 14, 2024

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

Yes, not needed, removed from description.

@acatangiu
Copy link
Contributor Author

acatangiu commented Mar 19, 2024

Proposed amounts

Based on fees distribution documented in paritytech/parity-bridges-common#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

  • SA of Polkadot asset hub to pay for the execution of ExportMessage: 13cKp89SgdtqUngo2WiEijPrQWdHFhzYZLf2TJePKRvExk7o (0x7369626ce8030000000000000000000000000000000000000000000000000000) - 100 DOT
  • SA of lane dedicated to asset hub for paying rewards for delivery: 13E5fui93Uyua5RtDv2LQj4aVBBHo6YREe3n6CBwYdqNqoxj (0x627261700000000162686b7300726577617264732d6163636f756e7400000000) - 5000 DOT
  • SA of lane dedicated to asset hub for paying rewards for delivery confirmation: 13E5fui93Uyua5RtDv2c9kcAbfrVFeeHyJzHe8sn1Ti77Afd (0x627261700000000162686b7301726577617264732d6163636f756e7400000000) - 5000 DOT

Total: 10_100 DOT

On Kusama BridgeHub

  • SA of Kusama asset hub to pay for the execution of ExportMessage: FBeL7EFTDeHnuViqaUHUXvhhUusN5FawDmHgfvzF97DXFr3 (0x7369626ce8030000000000000000000000000000000000000000000000000000) - 30 KSM
  • SA of lane dedicated to asset hub for paying rewards for delivery: EoQBtnwp4jMtCEpV7C88rKrz6x1qMBh2z74ibGSqtZRnuMM (0x62726170000000016268706400726577617264732d6163636f756e7400000000) - 1000 KSM
  • SA of lane dedicated to asset hub for paying rewards for delivery confirmation: EoQBtnwp4jMtCEpV7CPsssT6bdDHuHZmf3aGXxHJiSA4Dz3 (0x62726170000000016268706401726577617264732d6163636f756e7400000000) - 1000 KSM

Total: 2_030 KSM

@acatangiu
Copy link
Contributor Author

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
Copy link
Contributor Author

acatangiu commented Mar 19, 2024

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

franciscoaguirre commented Mar 20, 2024

Regarding the amounts in those calls:

  • In Polkadot
    • To Polkadot Asset Hub sov account: 100 DOT
    • To sov account of lane giving delivery rewards: 5000 DOT
    • To sov account of lane giving delivery confirmation rewards: 5000 DOT
  • In Kusama:
    • To Kusama Asset Hub sov account: 30 KSM
    • To sov account of lane giving delivery rewards: 1000 KSM
    • To sov account of lane giving delivery confirmation rewards: 1000 KSM

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
Copy link
Contributor Author

Done, see updated comment: #238 (comment)

@bkontur
Copy link
Contributor

bkontur commented Mar 20, 2024

just a nit - one more 0x here:

0x0x7369626ce8030000000000000000000000000000000000000000000000000000
  0x7369626ce8030000000000000000000000000000000000000000000000000000

@franciscoaguirre
Copy link
Contributor

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

@acatangiu
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

acatangiu commented Mar 20, 2024

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

  • -----> Need some rank3+ to open a Fellowship referendum to whitelist the 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
Copy link
Contributor Author

Kusama side executed, Kusama BH accounts successfully funded 🎉

@acatangiu
Copy link
Contributor Author

Polkadot also executed, accounts successfully funded. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants