You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: changelog.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,25 +10,22 @@ This changelog is based on [Keep A Changelog](https://keepachangelog.com/en/1.1.
10
10
Possibility to interact with smart-contracts used by earlier versions is lost.
11
11
Governance authority will have to establish new partner chain on Cardano.
12
12
All initialization and candidates registrations have to be repeated.
13
-
*Switched from `polkadot-stable2503-07` to `polkadot-stable2506`. `type RuntimeEvent` became deprecated in polkadot-sdk. It has been removed from the toolkit crates. To update to this version of PC toolkit, please remove definition of `type RuntimeEvent` when wiring in runtime.
13
+
*Updated from `polkadot-stable2503-07` to `polkadot-stable2506-2`. `type RuntimeEvent` became deprecated in polkadot-sdk. It has been removed from the toolkit crates. To update to this version of PC toolkit, please remove definition of `type RuntimeEvent` when wiring in runtime.
14
14
* Added extra constant burn fee in `pallet-address-association` to discourage attacks on pallet storage.
15
-
* Fixed panic when running `ariadne-parameters`, `registration-status` and `sidechain-params` subcommands when chain spec without initial authorities is used.
16
15
* Wizards don't require `generate-keys` for `prepare-configuration`. Altered recommended order of `create-chain-spec` and `setup-main-chain-state`.
17
16
*`MainchainAddress` is now serialized as plain String instead of hexstring of its bytes
18
17
* Wizards use optional env vars: PC_CHAIN_CONFIG_FILE and PC_RESOURCES_CONFIG_FILE env variables to
19
18
locate the chain config and resources config files
20
19
*`pallet-block-producer-metadata` is updated with a configurable fee for inserting the metadata, to make attacks on unbounded storage economically infeasible
* Added `valid_before` argument to the signed message and all extrinsics in `pallet_block_producer_metadata`. This is to
23
21
prevent unauthorized re-submission of metadata updates. The `sign-block-producer-metadata` command was updated to
24
22
match this change.
25
-
*`partner-chain-cli` (wizards) does not execute `<pc-node> build-spec` but creates the chain-spec.json file directly with a code injected into the command.
* Debug strings generated by `byte-string-derive` crate now fully pad output hex with zeros
27
25
*`authority-selection-inherents` crate now exports all its public members from the crate root
28
26
*`select_authorities` in `authority-selection-inherents` crate now returns a `BoundedVec` of `CommitteeMembers`. Projects that used the old version no longer
29
27
need to transform the data in their own runtime code
30
-
* Updates Rust dependency to v1.88, changes WASM target to 'wasm32v1-none'
31
-
* Backward compatible Encode and Decode for legacy chains that operate with AURA and Grandpa keys as session keys.
28
+
* Updated Rust toolchain to v1.90, changed WASM target to 'wasm32v1-none'
32
29
* Macro `observed_async_trait` in `partner-chains-db-sync-data-sources` crate has been made non-public.
33
30
34
31
## Added
@@ -47,11 +44,11 @@ In SCALE encoding of inherent data custom implementations of `Encode` and `Decod
47
44
48
45
`getAriadneParameters` and `getRegistrations` RPC results format has changed, `auraPubKey` and `grandpaPubKey` are replaced by `"keys": {"aura": "...", "gran": "..."}`.
A set of modules implementing observability layer, runtime pallet and offchain commands for a trustless token bridge moving tokens from Cardano to the Partner Chain.
53
50
54
-
This bridge feature works by monitoring an *illiquid supply validator address* on Cardano for new UTXOs. These UTXOs are interpreted as being either user-initiated
51
+
This bridge feature works by monitoring an *illiquid circulation supply validator address* on Cardano for new UTXOs. These UTXOs are interpreted as being either user-initiated
55
52
transfers sent to a specified address on the Partner Chain, or reserve transfers made as part of the chain's operations for the purposes of distributing them as
56
53
block producer rewards on-chain. Handling of the transfers is left to the chain builders themselves to implement according to their business needs and ledger structure.
57
54
@@ -67,6 +64,7 @@ The data sources will automatically detect this option on startup and adjust the
67
64
68
65
*`smart-contracts` governance actions were failing due too redundant signature when initiated by non-governance wallet
69
66
* Wizards using 'sidechain' in command line parameters are changed to use 'partner-chain' instead
67
+
* Fixed panic when running `ariadne-parameters`, `registration-status` and `sidechain-params` subcommands when chain spec without initial authorities is used.
Copy file name to clipboardExpand all lines: docs/developer-guides/bridge-and-reserve.md
+66-29Lines changed: 66 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,20 +1,30 @@
1
-
# Native token reserve management
1
+
# Native token bridge and reserve management
2
2
3
3
## Overview
4
4
5
+
The bridge functionality allows to register movement of designated native token (minting policy of it is controlled by users) to the bridge (also called Illiquid Circulation Supply Validator).
6
+
The Illiquid Circulation Supply Validator locks native tokens and prevents moving them out of the bridge.
7
+
For operational reasons (coin selection problem), the system allows setting a minimum number of UTXOs that should always be present at the bridge address, by creating UTXOs that contain a special token. The validator ensures that this token can not be moved out of the address and any UTXOs there can only contain one token each.
8
+
9
+
Additionally to the bridge there is the Reserve mechanism.
10
+
Reserve is set up by the governance authority with some amount of designated native tokens.
11
+
More tokens can be deposited to the reserve later.
12
+
Any user can release tokens from the reserve to the bridge - conceptually this should be observed at partner chain and some kind of rewards pool should be increased there.
13
+
Release can be done only with the amount that is bounded by so-called `V-function` (release schedule function).
14
+
5
15
This guide covers the following tasks:
6
16
7
17
1.**On Cardano:**
8
18
9
-
- Creating your new token and setting up rules for how tokens are released over time
10
-
- This involves setting up and managing a token management contract on the Cardano blockchain, enabling proper observability on your partner chain.
19
+
- Creating your new token, and optionally setting up rules for how tokens can be released from the reserve over time
20
+
- This involves setting up and managing a bridge and reserve contracts on the Cardano blockchain, enabling proper observability on your partner chain.
11
21
12
22
2.**On your partner chain:**
13
23
14
24
- Connecting your partner chain to track the token and enable token operations across both chains
15
25
- This involves following a step-by-step process for interacting with both the Cardano blockchain and your partner chain.
16
26
17
-
After you complete the steps in this guide, you will have a fully functioning token system that works across Cardano and your partner chain.
27
+
After you complete the steps in this guide, you will have fully functioning bridge and reserve systems that work across Cardano and your Partner Chain.
@@ -34,7 +44,7 @@ Please note that rewards schemes for token release is the responsibility of the
34
44
35
45
# Initialization
36
46
37
-
Initialization includes creating the native token on Cardano, writing the `VFunction`, running the commands `smart-contracts reserve init` and `smart-contracts reserve create` at the `partner-chains-node` side.
47
+
Initialization includes creating the native token on Cardano, writing the `VFunction`, running the commands `smart-contracts bridge init` and `smart-contracts reserve create-utxos`, `smart-contracts reserve init`, and `smart-contracts reserve create` at the `partner-chains-node` side.
38
48
39
49
## 1. Setting up your token on Cardano
40
50
@@ -60,26 +70,17 @@ Generally speaking, however, the process includes these steps:
60
70
61
71
### 1.2 Configuring the token release schedule
62
72
73
+
The release schedule is only required if the reserve feature is used.
74
+
63
75
#### 1.2.1 Implementing V(t) release function
64
76
65
77
**Understanding the `VFunction`:**
66
78
67
79
- The `VFunction` policy defines the schedule of allowed reserve token movement from the reserve supply to the circulating supply over time
68
80
69
-
-`VFunction` is a minting policy that has to accept 2 parameters (or more if you like)
70
-
71
-
- The first parameter is the `VFunction` Redeemer (which can be anything)
72
-
- The second parameter is the `ScriptContext` (every smart contract takes this as parameter)
73
-
74
-
- The Validity interval is to be present and equal to `[T, infinity]`, where `T` is time in the recent past, close to the current time
81
+
-`VFunction` is a minting policy. Offchain code will apply `ScriptContext` with the validity interval start of `T`, where `T` is the timestamp of currently observed chain tip.
75
82
76
-
- The Transaction input with ReserveAuthPolicy token is to be present
77
-
78
-
- The `VFunction` should be able to mint X tokens and be invoked repeatedly, each time minting X new tokens. The value of X should grow in time and represent the total number of tokens to be released from the reserve to IlliquidCirculationSupply up to the current moment in time
79
-
80
-
- Smart contracts do not pass anything to each other directly. However, each smart contract in a given single transaction has access to the context of the whole transaction, including input UTXOs, datums, etc
81
-
82
-
- Implementers of the `VFunction` should expect the validity interval to be correctly set up by the offchain release command.
83
+
- The `VFunction` should allow to mint at most the maximum number of tokens that are allowed to be released from the reserve until `T`.
The command is a governance action, so it might not submit transactions but instead output the transactions to sign.
164
+
132
165
### 1.3 Initializing token reserve controls
133
166
134
167
Objective: Initialize the reserve management system for your token.
@@ -207,9 +240,9 @@ Usage includes the `reserve release` and `reserve handover` commands.
207
240
-`reserve handover`– a command for finishing the flow (either there is nothing to release or the governance authority user wants to finish the flow)
208
241
-`reserve release`– a command to "move" the flow until the end.
209
242
210
-
## 2. Releasing tokens from reserve to circulation
243
+
## 2. Releasing tokens from Cardano Reserve to bridge
211
244
212
-
Objective: Release available reserve tokens (defined by the `VFunction`).
245
+
Objective: Release available reserve tokens (maximum amount is bounded by `VFunction`)
213
246
214
247
### 2.1 Run the `reserve release` command
215
248
@@ -301,23 +334,27 @@ Objective: increase the pool of reserve tokens.
301
334
302
335
# Configuration
303
336
304
-
Configuration includes `reserve update-settings` commands used to either change token in reserve or`VFunction`.
337
+
Configuration includes `reserve update-settings` commands used to change the`VFunction`.
305
338
306
339
<!-- Only "initialize", "create" and "update settings" are related to configuration. -->
307
340
308
341
## 4. Connecting your token to your partner chain
309
342
310
343
### 4.1 Gathering required token parameters
311
344
312
-
Objective: Collect the essential parameters needed to configure the native token management contract on the partner chain.
345
+
Objective: Collect the essential parameters needed to configure the bridge pallet on the partner chain.
313
346
314
347
#### Required parameters
315
348
316
-
- NATIVE_TOKEN_POLICY_ID - the policy ID from Step 1.1
349
+
- tokenPolicyId - the policy ID from Step 1.1
350
+
351
+
- tokenAssetName - the asset name from Step 1.1
352
+
353
+
- IlliquidCirculationSupplyValidatorAddress - can be obtained from the output of the `get-scripts` command (see below).
317
354
318
-
- NATIVE_TOKEN_ASSET_NAME - the asset name from Step 1.1
355
+
- dataCheckpoint - it is the lower bound of observability. Chain Genesis UTXO is a good candidate,
356
+
but it can be any UTXO on Cardano, created before the first bridge transfer that should be registered by the Partner Chain
319
357
320
-
- ILLIQUID_SUPPLY_VALIDATOR_ADDRESS - can be obtained from the output of the `get-scripts` command (see below).
321
358
322
359
#### 4.1.1 Retrieving the validator address
323
360
@@ -341,13 +378,13 @@ Locate the validator address in the command output:
341
378
}
342
379
```
343
380
344
-
### 4.2 Following the native token migration guide
381
+
### 4.2 Following the bridge migration guide
345
382
346
383
Objective: Migrate and synchronize the token state between Cardano and the partner chain.
347
384
348
385
#### Steps
349
386
350
-
1. Open the [native token migration guide](https://github.com/input-output-hk/partner-chains/blob/master/docs/developer-guides/native-token-migration-guide.md).
387
+
1. Open the [bridge migration guide](https://github.com/input-output-hk/partner-chains/blob/master/docs/developer-guides/bridge-migration-guide.md).
351
388
352
389
2. Follow each step outlined in the guide.
353
390
@@ -361,13 +398,13 @@ Objective: Update native token configuration if migration has already happened.
361
398
362
399
**Warning:** The following steps need to be executed by the governance authority from the sudo account in the Polkadot UI.
363
400
364
-
1. Run `set_main_chain_scripts` extrinsic on the nativeTokenManagement pallet via the Polkadot UI portal to set the native token `policy ID`, `asset name`, and `illiquid supply validator address`.
401
+
1. Run `set_main_chain_scripts` extrinsic on the bridge pallet via the Polkadot UI portal to set the native token `tokenPolicyId`, `tokenAssetName`, `IlliquidCirculationSupplyValidatorAddress`, and `dataCheckpoint`.
id1["Obtain native token parameters from configuration"] --> id2["Update partner chain source code"] --> id3["Build new partner chain version"] --> id4["Deploy new partner chain version"] --> id5["Upgrade runtime"] --> id6["Set native token and data checkpoint parameters"]
35
37
```
36
38
37
39
### Preparing changes
38
-
1. Add the `native-token-management` pallet into the runtime. This requires implementing the trait `TokenTransferHandler`, which
40
+
1. Add the `bridge` pallet into the runtime. This requires implementing the trait `TransferHandler`, which
39
41
is left for the developers of each particular partner chain to implement according to their needs and
40
42
ledger structure. Consult the implementation in `runtime/src/lib.rs` for an example with a mocked handler.
41
43
2. Wire the data source into the node.
@@ -51,13 +53,13 @@ The following steps need to be performed in order:
51
53
1. Upgrade the nodes running the chain to the new node version containing the inherent data provider.
52
54
2. Perform a [runtime upgrade](https://docs.substrate.io/maintain/runtime-upgrades/) (using `sudo` or other governance feature) to the new runtime version containing the pallet.
53
55
3. Invoke the `set_main_chain_scripts` extrinsic on the newly added pallet, using the governance mechanism,
54
-
to set the native token `policy ID` and `asset name`, and the `illiquid supply validator address`. After
56
+
to set the `tokenPolicyId`, `tokenAssetName`, `IlliquidCirculationSupplyValidatorAddress`, and `dataCheckpoint`. After
55
57
this step all information necessary is present, and the native token data provider will start producing
56
-
the inherent data based on observed native token transfers, triggering the pallet's inherent when necessary.
58
+
the inherent data based on observed native token transfers, triggering the pallet's inherent when necessary.
57
59
58
60
## Migration Steps - removing the feature
59
61
60
-
1. Remove the pallet completely from the runtime. The `TokenTransferHandler` can be removed as well. To support syncing and validating historical blocks, the data source and inherent data provider *must* not be removed from the node.
62
+
1. Remove the pallet completely from the runtime. The `TransferHandler` can be removed as well. To support syncing and validating historical blocks, the data source and inherent data provider *must* not be removed from the node.
Copy file name to clipboardExpand all lines: docs/developer-guides/sdk-update-v1.7-to-v1.8.0.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,3 +60,7 @@ fn current_time() -> u64 {
60
60
pallet_timestamp::Now::<Runtime>::get() /1000
61
61
}
62
62
```
63
+
64
+
## Bridge
65
+
66
+
For the bridge please read documents specific to this feature: [operational guide](./bridge-and-reserve.md) and [migration guide](./bridge-migration-guide.md)
0 commit comments