Skip to content

Commit

Permalink
Add max runtime version in get_info
Browse files Browse the repository at this point in the history
  • Loading branch information
kvinwang committed Feb 28, 2023
1 parent 837b239 commit 08db6e9
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/phactory/api/proto
Submodule proto updated 1 files
+2 −0 pruntime_rpc.proto
4 changes: 4 additions & 0 deletions crates/phactory/src/prpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ impl<Platform: pal::Platform + Serialize + DeserializeOwned> Phactory<Platform>
can_load_chain_state: self.can_load_chain_state,
safe_mode_level: self.args.safe_mode_level as _,
current_block_time,
max_supported_pink_runtime_version: {
let (major, minor) = ::pink::runtimes::max_supported_version();
format!("{major}.{minor}")
},
};
info!("Got info: {:?}", info);
info
Expand Down
4 changes: 4 additions & 0 deletions crates/pink/runner/src/runtimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ fn in_enclave() -> i32 {
}

pub mod v1;

pub fn max_supported_version() -> (u32, u32) {
(1, 0)
}
3 changes: 2 additions & 1 deletion e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
},
"devDependencies": {
"protobufjs": "^6.11.3"
}
},
"packageManager": "[email protected]"
}
Binary file modified e2e/res/check_system/sideprog.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion e2e/res/check_system/sideprog.wasm.hash
Original file line number Diff line number Diff line change
@@ -1 +1 @@
���L�x��j�#�i�»��L������m�BG�l
����;S�-�u������@)G�SMn���
2 changes: 1 addition & 1 deletion e2e/res/check_system/target/ink/check_system.contract

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion e2e/res/system.contract

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions e2e/src/proto/pruntime_rpc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,9 @@ export namespace pruntime_rpc {

/** PhactoryInfo currentBlockTime */
currentBlockTime?: (number|Long|null);

/** PhactoryInfo maxSupportedPinkRuntimeVersion */
maxSupportedPinkRuntimeVersion?: (string|null);
}

/** Represents a PhactoryInfo. */
Expand Down Expand Up @@ -816,6 +819,9 @@ export namespace pruntime_rpc {
/** PhactoryInfo currentBlockTime. */
public currentBlockTime: (number|Long);

/** PhactoryInfo maxSupportedPinkRuntimeVersion. */
public maxSupportedPinkRuntimeVersion: string;

/** PhactoryInfo _genesisBlockHash. */
public _genesisBlockHash?: "genesisBlockHash";

Expand Down
22 changes: 22 additions & 0 deletions e2e/src/proto/pruntime_rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,7 @@ $root.pruntime_rpc = (function() {
* @property {boolean|null} [canLoadChainState] PhactoryInfo canLoadChainState
* @property {number|null} [safeModeLevel] PhactoryInfo safeModeLevel
* @property {number|Long|null} [currentBlockTime] PhactoryInfo currentBlockTime
* @property {string|null} [maxSupportedPinkRuntimeVersion] PhactoryInfo maxSupportedPinkRuntimeVersion
*/

/**
Expand Down Expand Up @@ -1288,6 +1289,14 @@ $root.pruntime_rpc = (function() {
*/
PhactoryInfo.prototype.currentBlockTime = $util.Long ? $util.Long.fromBits(0,0,true) : 0;

/**
* PhactoryInfo maxSupportedPinkRuntimeVersion.
* @member {string} maxSupportedPinkRuntimeVersion
* @memberof pruntime_rpc.PhactoryInfo
* @instance
*/
PhactoryInfo.prototype.maxSupportedPinkRuntimeVersion = "";

// OneOf field names bound to virtual getters and setters
var $oneOfFields;

Expand Down Expand Up @@ -1390,6 +1399,8 @@ $root.pruntime_rpc = (function() {
writer.uint32(/* id 25, wireType 0 =*/200).uint32(message.safeModeLevel);
if (message.currentBlockTime != null && Object.hasOwnProperty.call(message, "currentBlockTime"))
writer.uint32(/* id 26, wireType 0 =*/208).uint64(message.currentBlockTime);
if (message.maxSupportedPinkRuntimeVersion != null && Object.hasOwnProperty.call(message, "maxSupportedPinkRuntimeVersion"))
writer.uint32(/* id 27, wireType 2 =*/218).string(message.maxSupportedPinkRuntimeVersion);
return writer;
};

Expand Down Expand Up @@ -1487,6 +1498,9 @@ $root.pruntime_rpc = (function() {
case 26:
message.currentBlockTime = reader.uint64();
break;
case 27:
message.maxSupportedPinkRuntimeVersion = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
Expand Down Expand Up @@ -1598,6 +1612,9 @@ $root.pruntime_rpc = (function() {
if (message.currentBlockTime != null && message.hasOwnProperty("currentBlockTime"))
if (!$util.isInteger(message.currentBlockTime) && !(message.currentBlockTime && $util.isInteger(message.currentBlockTime.low) && $util.isInteger(message.currentBlockTime.high)))
return "currentBlockTime: integer|Long expected";
if (message.maxSupportedPinkRuntimeVersion != null && message.hasOwnProperty("maxSupportedPinkRuntimeVersion"))
if (!$util.isString(message.maxSupportedPinkRuntimeVersion))
return "maxSupportedPinkRuntimeVersion: string expected";
return null;
};

Expand Down Expand Up @@ -1685,6 +1702,8 @@ $root.pruntime_rpc = (function() {
message.currentBlockTime = object.currentBlockTime;
else if (typeof object.currentBlockTime === "object")
message.currentBlockTime = new $util.LongBits(object.currentBlockTime.low >>> 0, object.currentBlockTime.high >>> 0).toNumber(true);
if (object.maxSupportedPinkRuntimeVersion != null)
message.maxSupportedPinkRuntimeVersion = String(object.maxSupportedPinkRuntimeVersion);
return message;
};

Expand Down Expand Up @@ -1732,6 +1751,7 @@ $root.pruntime_rpc = (function() {
object.currentBlockTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.currentBlockTime = options.longs === String ? "0" : 0;
object.maxSupportedPinkRuntimeVersion = "";
}
if (message.initialized != null && message.hasOwnProperty("initialized"))
object.initialized = message.initialized;
Expand Down Expand Up @@ -1793,6 +1813,8 @@ $root.pruntime_rpc = (function() {
object.currentBlockTime = options.longs === String ? String(message.currentBlockTime) : message.currentBlockTime;
else
object.currentBlockTime = options.longs === String ? $util.Long.prototype.toString.call(message.currentBlockTime) : options.longs === Number ? new $util.LongBits(message.currentBlockTime.low >>> 0, message.currentBlockTime.high >>> 0).toNumber(true) : message.currentBlockTime;
if (message.maxSupportedPinkRuntimeVersion != null && message.hasOwnProperty("maxSupportedPinkRuntimeVersion"))
object.maxSupportedPinkRuntimeVersion = message.maxSupportedPinkRuntimeVersion;
return object;
};

Expand Down

0 comments on commit 08db6e9

Please sign in to comment.