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

Snowbridge: Register Ether Asset and Lower Bridge Fees #560

Open
alistair-singh opened this issue Jan 26, 2025 · 1 comment
Open

Snowbridge: Register Ether Asset and Lower Bridge Fees #560

alistair-singh opened this issue Jan 26, 2025 · 1 comment

Comments

@alistair-singh
Copy link
Contributor

alistair-singh commented Jan 26, 2025

The Proposal

  1. Lowers the cost of bridge transfers from Polkadot to Ethereum from ~6.12 DOT to ~1.49 DOT.
  2. Register the Ether asset on Asset Hub in preparation for the Support Native Ether feature ahead of fellowship runtime release v1.4.0.
  3. Ether is made sufficient and the minimum balance is 15000 Gwei.
  4. Ether metadata: Name = Ether, Symbol = ETH, Decimals = 18.

Referenda Links

https://polkadot.subsquare.io/referenda/1400
https://polkadot.polkassembly.io/referenda/1400

OpenGov

$ opengov-cli submit-referendum --proposal preimage.hex --network polkadot --track whitelisted-caller --after 100 --output-len-limit 1000 --output AppsUiLink

Submit the preimage for the Fellowship referendum:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x2b00d41f0004010004082f0000060342c78b76216f8817007a52bbb0760cc912f66fe3144fe009483e3084ccf3148d1163d25d81b88de234

Open a Fellowship referendum to whitelist the call:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x3d003e02021f62f8c5c6ec8aa23a6c6b66934e673ff263b9bff333a62d681cdde6ee34cf1b35000000010a000000

Submit the preimage for the public referendum:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x0a00c90417031a020c630003000100a90f030c2f00000602b25ec1b65946c9015302b1ca223c39210800000000000000000000e1f50500000000000000000000000000a031a95fe3000000000000000000000000000000000000000000000000000000e40b5402000000000000000000000000000000000000000000000000000000000064a7b3b6e00d00000000000000002000630003000100a10f030c2f000006025e45e4240094000404405fbc5c7ba58845ad1f1a9a7c5bc12fad4086b7de790300000000000000000000002000630003000100a10f03142f00000602e2b62e3a7953c03501020109070400204dfe37731e8e2b4866ad0da9a17c49f434542c3477c5f914a3349acd88ba1a010b00f0ab75a40d200006028673d63a79534c351302010907041445746865720c45544812002000

Open a public referendum to dispatch the call:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x1500160d029e75507531c432fe9b1c5e33c918438342d2e23262de92375151f379258e29a1320100000164000000

Batch to submit on Polkadot Relay Chain:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-rpc.dwellir.com#/extrinsics/decode/0x1a04080a00c90417031a020c630003000100a90f030c2f00000602b25ec1b65946c9015302b1ca223c39210800000000000000000000e1f50500000000000000000000000000a031a95fe3000000000000000000000000000000000000000000000000000000e40b5402000000000000000000000000000000000000000000000000000000000064a7b3b6e00d00000000000000002000630003000100a10f030c2f000006025e45e4240094000404405fbc5c7ba58845ad1f1a9a7c5bc12fad4086b7de790300000000000000000000002000630003000100a10f03142f00000602e2b62e3a7953c03501020109070400204dfe37731e8e2b4866ad0da9a17c49f434542c3477c5f914a3349acd88ba1a010b00f0ab75a40d200006028673d63a79534c351302010907041445746865720c455448120020001500160d029e75507531c432fe9b1c5e33c918438342d2e23262de92375151f379258e29a1320100000164000000

Batch to submit on Polkadot Collectives Chain:
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fpolkadot-collectives-rpc.polkadot.io#/extrinsics/decode/0x2804082b00d41f0004010004082f0000060342c78b76216f8817007a52bbb0760cc912f66fe3144fe009483e3084ccf3148d1163d25d81b88de2343d003e02021f62f8c5c6ec8aa23a6c6b66934e673ff263b9bff333a62d681cdde6ee34cf1b35000000010a000000

Storage Update

The fee charged to Asset Hub users must be updated via a storage update as it is a storage variable defined in the runtime here. The value is a Balance(Compact<u128>) little-endian integer which is SCALE encoded.
It is generated in the Snowbridge control tool during preimage generation.

You can use the typescript below to verify. Install deno to run: https://deno.com/

#!/usr/bin/env -S deno run --allow-env
import { xxhashAsHex } from "npm:@polkadot/util-crypto";
import { BN } from "npm:@polkadot/util";

console.log(
  "Storage Key:",
  xxhashAsHex(":BridgeHubEthereumBaseFee:", 128, true),
);
console.log(
  "Storage Value:",
  new BN(
    "86b7de79030000000000000000000000",
    "hex",
    "le",
  ).toString(),
);

Building the Preimage

https://github.com/Snowfork/snowbridge/tree/main/control#governance-tools

$ cargo run --features polkadot --bin \
      snowbridge-preimage -- gov-update202501 \
      --ether-min-balance 15000000000000 \
      --exchange-rate-numerator 1 \
      --exchange-rate-denominator 437 \
      --multiplier-numerator 1 \
      --multiplier-denominator 1 \
      --fee-per-gas 10  \
      --local-reward 0.01 \
      --remote-reward 0.00025
BridgeHub:
  ExchangeRate: 0.002288329519450801 ETH/DOT
  FeePerGas: 10.000000000 GWEI
  LocalReward: 0.0100000000 DOT [100000000 PLANCK]
  RemoteReward: 0.000250000000000000 ETH [250000000000000 WEI]
AssetHub:
  BaseFee: 1.4929540998 DOT, [14929540998 PLANCK]
Storage key for 'BridgeHubEthereumBaseFee': 0x5fbc5c7ba58845ad1f1a9a7c5bc12fad
Preimage Hash: 0x7a52bbb0760cc912f66fe3144fe009483e3084ccf3148d1163d25d81b88de234
Preimage Size: 304
0x1a020c630003000100a90f030c2f00000602b25ec1b65946c9015302b1ca223c39210800000000000000000000e1f50500000000000000000000000000a031a95fe3000000000000000000000000000000000000000000000000000000e40b5402000000000000000000000000000000000000000000000000000000000064a7b3b6e00d00000000000000002000630003000100a10f030c2f000006025e45e4240094000404405fbc5c7ba58845ad1f1a9a7c5bc12fad4086b7de790300000000000000000000002000630003000100a10f03142f00000602e2b62e3a7953c03501020109070400204dfe37731e8e2b4866ad0da9a17c49f434542c3477c5f914a3349acd88ba1a010b00f0ab75a40d200006028673d63a79534c351302010907041445746865720c45544812002000
  • Preview the full call on the Relaychain
  • Preview the resulting fee-lowering call on Bridge Hub
  • Preview the resulting fee-lowering call on Asset Hub
  • Preview the resulting eth create call on Asset Hub
  • Preview the resulting eth metadata creation call on Asset Hub

Testing

Tested using the Snowbridge runtime upgrade guide from step 3 onwards. Steps 1-2 which build the preimage are described in the section above using the Snowbridge control tool.

https://docs.snowbridge.network/operations/test-runtime-upgrades

@acatangiu
Copy link
Contributor

I double-checked everything and it's all good.

I submitted the whitelist referendum: https://collectives.subsquare.io/fellowship/referenda/280

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

2 participants