feat: Check subnet admins in deterministic state machine#8912
feat: Check subnet admins in deterministic state machine#8912dsarlis wants to merge 23 commits intodfinity:masterfrom
Conversation
|
Related spec change: dfinity/portal#6196. |
mraszyk
left a comment
There was a problem hiding this comment.
I'd introduce a dedicated CanisterManagerError (since the subnet record is public anyway) and harden the unit test. Otherwise LGTM
|
Note that I had to move the One thing I do not recall, is whether this change requires a new version of canonical state -- no tests failed there which would seem to indicate that we don't need one? |
We are not mapping anything new in the state tree so no new version is needed. |
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
Co-authored-by: mraszyk <31483726+mraszyk@users.noreply.github.com>
mraszyk
left a comment
There was a problem hiding this comment.
I also realized we don't have tests that subnet admins could use the query endpoint for canister status, but I don't have a strong opinion on the necessity of such a test.
|
I also realized in a live discussion with @nathanosdev that I missed updating the ingress filter check to not allow ingress messages to the subnet admin endpoints if a subnet admin is not the sender. I'll also fix that. |
Don't you need to relax this: |
Yes, I meant I'll need to update the check to be "controller or subnet admin is allowed" for the methods that this applies to. |
This PR builds on top of #8731 to add the checks related to the new subnet admins field and actions they can perform on canisters. Specifically, the subnet admins can
stop,start,uninstall,deleteand get the status of canisters but they cannot for exampleinstall_codeon them.The field is read from the registry and stored in the
NetworkTopologywhich can then be read by the Deterministic State Machine to perform any necessary checks. A new functionvalidate_controller_or_subnet_adminis added that performs the required checks. This function replaces the old one in the endpoints that are allowed to be called by subnet admins. In case the subnet admins field is empty, this function returns the same error as before (for backward compatibility), otherwise a new error is returned that captures the fact that the caller is neither a controller or subnet admin.Given that the ability to update the admins list is still under development (see #8911), this PR should currently act a no-op as all subnets have an empty subnet admins list.