SystemUtils

Git Source

Title: SystemUtils

Shared access to revive's System precompile for dotNS contracts.

Canonical wrapper around ISystem at DotnsConstants.REVIVE_SYSTEM, so the precompile address and interface are wired in one place rather than duplicated per consumer.

Note: security-contact: admin@parity.io

Functions

callerIsRoot

Returns whether substrate Root called this contract directly.

Reads ISystem.callerIsRoot, which is true only in the contract a Root dispatch targets, including behind its UUPS proxy, and false in any contract that contract calls. A contract reached later in the same Root transaction therefore cannot pass the check. A Root origin has no account behind it, so a function gated on this must not read msg.sender in the frame Root calls: reading it traps. Calls it makes are fine, because they see a contract as caller.

function callerIsRoot() internal view returns (bool root);

Returns

NameTypeDescription
rootboolTrue when the immediate caller is Root.

tryCallerIsRoot

Returns whether substrate Root called this contract directly, and false when the System precompile does not answer.

Same answer as @custom:function callerIsRoot on a chain with the precompile. Where the precompile is absent, such as the local simulation of a deployment script, the call fails and this returns false. A false answer only ever sends a gate to its stricter branch, so a failing call cannot grant Root.

function tryCallerIsRoot() internal view returns (bool root);

Returns

NameTypeDescription
rootboolTrue when the precompile answers that the immediate caller is Root.