Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 5 additions & 3 deletions cli/src/constants/pocket-ic.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import type {

export const SUBNET_CONFIG: SubnetSpec = {
state_config: 'New',
instruction_config: 'Production'
instruction_config: 'Production',
subnet_admins: null,
cost_schedule: 'Normal'
};

// https://github.com/dfinity/ic/blob/master/packages/pocket-ic/src/common/rest.rs#L557
export const ICP_CONFIG: IcpConfig = {
beta_features: 'Disabled',
canister_backtrace: 'Enabled',
function_name_length_limits: 'Enabled',
canister_execution_rate_limiting: 'Enabled'
};
Expand All @@ -24,7 +25,8 @@ export const ICP_CONFIG: IcpConfig = {
export const INSTANCE_HTTP_GATEWAY: Omit<InstanceHttpGatewayConfig, 'port'> = {
ip_addr: '0.0.0.0',
domains: null,
https_config: null
https_config: null,
domain_custom_provider_local_file: null
};

// Configures the instance to make progress automatically
Expand Down
13 changes: 10 additions & 3 deletions cli/src/services/pocket-ic/pocket-ic.services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ const buildInstanceConfig = async ({
bitcoin: null,
system: [],
application: [SUBNET_CONFIG],
verified_application: []
verified_application: [],
cloud_engine: []
},
state_dir: stateDir,
icp_config: ICP_CONFIG,
Expand All @@ -80,7 +81,10 @@ const buildInstanceConfig = async ({
...INSTANCE_HTTP_GATEWAY,
port: parseInt(port)
},
incomplete_state: INCOMPLETE_STATE
incomplete_state: INCOMPLETE_STATE,
dogecoind_addr: null,
mainnet_nns_subnet_id: null,
disable_ingress_validation: null
};

InstanceConfigSchema.parse(config);
Expand All @@ -106,7 +110,10 @@ const buildIcpFeatures = async (): Promise<IcpFeatures> => {
nns_governance: mapIcpFeature(nns),
sns: mapIcpFeature(sns),
ii: mapIcpFeature(internet_identity),
nns_ui: mapIcpFeature(nns_dapp)
nns_ui: mapIcpFeature(nns_dapp),
bitcoin: null,
dogecoin: null,
canister_migration: null
};

return IcpFeaturesSchema.parse(icpFeatures);
Expand Down
26 changes: 21 additions & 5 deletions cli/src/types/pocket-ic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ const IcpFeatureSchema = z.literal('DefaultConfig');

const SubnetInstructionConfigSchema = z.enum(['Production', 'Benchmarking']);

const CanisterCyclesCostScheduleSchema = z.enum(['Normal', 'Free']);

const RawPrincipalIdSchema = z.strictObject({
// base64-encoded string
principal_id: z.string()
});

const BlobIdSchema = z.string();
const SubnetStateConfigSchema = z.union([
z.literal('New'),
Expand All @@ -42,7 +49,9 @@ const InitialTimeSchema = z.union([

const SubnetSpecSchema = z.strictObject({
state_config: SubnetStateConfigSchema,
instruction_config: SubnetInstructionConfigSchema
instruction_config: SubnetInstructionConfigSchema,
subnet_admins: zNullable(z.array(RawPrincipalIdSchema)),
cost_schedule: CanisterCyclesCostScheduleSchema.default('Normal')
});

const ExtendedSubnetConfigSetSchema = z.strictObject({
Expand All @@ -53,19 +62,20 @@ const ExtendedSubnetConfigSetSchema = z.strictObject({
bitcoin: zNullable(SubnetSpecSchema),
system: z.array(SubnetSpecSchema),
application: z.array(SubnetSpecSchema),
cloud_engine: z.array(SubnetSpecSchema).default([]),
verified_application: z.array(SubnetSpecSchema)
});

const InstanceHttpGatewayConfigSchema = z.strictObject({
ip_addr: zNullable(z.string()),
port: zNullable(z.number().int().min(0).max(65535)),
domains: zNullable(z.array(z.string())),
https_config: zNullable(HttpsConfigSchema)
https_config: zNullable(HttpsConfigSchema),
domain_custom_provider_local_file: zNullable(z.string())
});

const IcpConfigSchema = z.strictObject({
beta_features: zNullable(IcpConfigFlagSchema),
canister_backtrace: zNullable(IcpConfigFlagSchema),
function_name_length_limits: zNullable(IcpConfigFlagSchema),
canister_execution_rate_limiting: zNullable(IcpConfigFlagSchema)
});
Expand All @@ -78,7 +88,10 @@ export const IcpFeaturesSchema = z.strictObject({
nns_governance: zNullable(IcpFeatureSchema),
sns: zNullable(IcpFeatureSchema),
ii: zNullable(IcpFeatureSchema),
nns_ui: zNullable(IcpFeatureSchema)
nns_ui: zNullable(IcpFeatureSchema),
bitcoin: zNullable(IcpFeatureSchema),
dogecoin: zNullable(IcpFeatureSchema),
canister_migration: zNullable(IcpFeatureSchema)
});

const IncompleteStateSchema = z.enum(['Disabled', 'Enabled']);
Expand All @@ -90,9 +103,12 @@ export const InstanceConfigSchema = z.strictObject({
icp_config: zNullable(IcpConfigSchema),
log_level: zNullable(z.string()),
bitcoind_addr: zNullable(z.array(SocketAddrSchema)),
dogecoind_addr: zNullable(z.array(SocketAddrSchema)),
icp_features: zNullable(IcpFeaturesSchema),
incomplete_state: zNullable(IncompleteStateSchema),
initial_time: zNullable(InitialTimeSchema)
initial_time: zNullable(InitialTimeSchema),
mainnet_nns_subnet_id: zNullable(z.boolean()),
disable_ingress_validation: zNullable(z.boolean())
});

export type InstanceHttpGatewayConfig = z.infer<typeof InstanceHttpGatewayConfigSchema>;
Expand Down
4 changes: 2 additions & 2 deletions ic.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pocket-ic": {
"commit": "d6026d28caf4733e831ae058cb9ee87443ad4c0b",
"version": "12.0.0",
"commit": "e9a67c25a407bf7252510ddcc680b5c7e6f657ed",
"version": "13.0.0",
"artifacts": {
"linux/amd64": "https://github.com/dfinity/pocketic/releases/download/{version}/pocket-ic-x86_64-linux.gz",
"linux/arm64": "https://github.com/dfinity/pocketic/releases/download/{version}/pocket-ic-arm64-linux.gz"
Expand Down
Loading