Skip to content

Idempotent proposal functions #1791

Closed
Closed
@lynshi

Description

@lynshi

Is your feature request related to a problem? Please describe.
Proposal functions are not idempotent, and this can cause errors if a proposal is submitted to create a state that already exists. For example, open_network calls open_service, which returns false if the network is already open, which causes open_network to indicate the proposal failed. Similarly, new_user calls add_user, which fails if the user certificate already exists.

This is problematic because errors for a resubmitted proposal will cause the client's backoff code to retry proposals unnecessarily and eventually fail despite the fact that the desired state is already achieved. In a multi-member consortium, it's also possible that proposals with the same effect are accepted and executed concurrently, in which case the later-to-execute proposal may fail though its intended effect has been applied.

Describe the solution you'd like
Proposal functions hardcoded in C++ should be idempotent so that they can run successfully if accepted by members despite having no effect. This avoids requiring additional logic in the constitution, proposal, or vote to protect against misleading proposal failures.

Additional context
As discussed with @achamayou and @eddyashton, this issue can be mitigated initially with a side-by-side introduction of idempotent functions equivalent to existing proposal functions, such as user_present for adding a user.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions