use of com.radixdlt.constraintmachine.exceptions.SignedSystemException in project radixdlt by radixdlt.
the class ConstraintMachine method callProcedure.
/**
* Executes a transition procedure given the next spun particle and a current validation state.
*/
private ReducerState callProcedure(Procedure procedure, Object procedureParam, ReducerState reducerState, Resources immutableAddrs, ExecutionContext context) throws SignedSystemException, InvalidPermissionException, AuthorizationException, MeterException, ProcedureException {
// System permissions don't require additional authorization
var authorization = procedure.authorization(procedureParam);
var requiredLevel = authorization.permissionLevel();
context.verifyPermissionLevel(requiredLevel);
if (context.permissionLevel() != PermissionLevel.SYSTEM) {
try {
if (requiredLevel == PermissionLevel.USER) {
this.meter.onUserProcedure(procedure.key(), procedureParam, context);
} else if (requiredLevel == PermissionLevel.SUPER_USER) {
this.meter.onSuperUserProcedure(procedure.key(), procedureParam, context);
}
} catch (Exception e) {
throw new MeterException(e);
}
if (!context.skipAuthorization()) {
try {
authorization.authorizer().verify(immutableAddrs, context);
} catch (Exception e) {
throw new AuthorizationException(e);
}
}
}
return procedure.call(procedureParam, reducerState, immutableAddrs, context).state();
}
Aggregations