SNS: GenericNervousSystemFunction validator_canister_id and validator_method_name

According to ICSCAN and the snsdemo repo, the Candid for GenericNervousSystemFunction is:

type GenericNervousSystemFunction = record {
  validator_canister_id : opt principal;
  target_canister_id : opt principal;
  validator_method_name : opt text;
  target_method_name : opt text;
};

target_canister_id and target_method_name seem self-explanatory.

What are validator_canister_id and validator_method_name?

1 Like

@mraszyk shared a link the SNS Testflight docs in another thread.

Under Test executing code on SNS managed canisters via SNS proposals it says:

To execute code on SNS managed canisters via SNS proposals, the canisters must expose a pair of public functions (refered to as generic functions in the following):

  • a validation function to validate and render the proposal payload;
  • an execution function to perform an action given the proposal payload.

The validation function must return a value of the Candid type variant { Ok: text; Err: text; }, e.g., Result<String, String> in Rust. If the validation function returns Ok(rendering), then the proposal is submitted and the rendering string is included into the proposal. Otherwise, the proposal submission fails.

The execution function gets the same binary payload as passed to the validation function and its code gets executed if the proposal is accepted. It should not return any value because this return value is ignored.

2 Likes