Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
support preopen hrmp channels
  • Loading branch information
0x8f701 committed Nov 19, 2021
commit af709e0bcf50ed900e13c6ca5fe28fa90504c65f
1 change: 0 additions & 1 deletion configs/karura.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,3 @@ parachains:
nodes:
- flags:
- --alice

10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ const generateRelaychainGenesisFile = (config: Config, path: string, output: str

// additional patches
if (config.relaychain.runtimeGenesisConfig) {
const hrmp = config.relaychain.runtimeGenesisConfig.hrmp;
if (hrmp) {
hrmp.preopenHrmpChannels = hrmp.preopenHrmpChannels.map((channel) => {
if (!Array.isArray(channel)) {
return [channel.sender, channel.recipient, channel.maxCapacity, channel.maxMessageSize];
} else {
return channel;
}
});
}
_.merge(runtime, config.relaychain.runtimeGenesisConfig);
}

Expand Down
12 changes: 12 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export interface RelayChain {
nodes: Node[];
runtimeGenesisConfig: {
configuration: { config: { [index: string]: string | number } };
hrmp?: {
preopenHrmpChannels: HrmpChannelsConfig[];
};
};
}

Expand Down Expand Up @@ -68,3 +71,12 @@ export interface DockerNode {
};
};
}

export type HrmpChannelsConfig =
| {
sender: number;
recipient: number;
maxCapacity: number;
maxMessageSize: number;
}
| [number, number, number, number];