-
Notifications
You must be signed in to change notification settings - Fork 19
Naming Conventions and Deprecation Policy
Robert La Ferla edited this page Jul 26, 2023
·
3 revisions
SCALE encoding and a lot of the metadata relies on stable indices. When adding any of the prior, do NOT reorder. ALWAYS add to the end. Those relying on those magic numbers thank you.
- Pallet Indexes
- Events
- Extrinsics
- Argument order
Remember that more is external than it might appear.
- State Queries
- Constants
- Runtime Calls
- Custom RPCs
Changes MUST follow the deprecation pattern.
Changes will happen and eventual deprecation of something is expected. Any change that alters an external interface MUST follow the following if at all possible.
- Create a new interface, if necessary, suffix the name(s) with
_v2
(or correct integer increment). - In Rust, tag the prior interface as
#[deprecated = "Use xxxx_v2 instead"]
- Note in the Changelog the deprecation.
- Wait at least 6 months.
- Remove the deprecated interface noting the "Breaking Change" in the Changelog
- Avoid single words on external interfaces
- Governance managed variables should be prefaced by
governance
- Be descriptive
-
is
/has
: Should return abool
- Single Maps
- [map key]To[map value]
- [map value]For[map key]
- Double Maps
- [map key]And[map key 2]To[map value]
- N Maps
- Good Luck
- [Max/Min][Foo]Per[Bar]
- Verbs
-
set
: Change a value to a new value -
add
: Append to a list of something -
create
: Creating something new that might have other things added to it -
register
: USEcreate
INSTEAD -
grant/revoke
: Permission oriented terms -
delete
: Never about permissions, actually delete something -
retire
: Delete is not right, but neither is revoke (Used for MSAs "removal" only)
-
- Junctions
with
by
- Help
- Foo
grants/revokes
apermission
- A
delegator
creates a delegation with aprovider
- A user
creates
an MSA and thenadds
public keys to it.
- Foo
-
getBy
: pallet_getByFoo -
check
: Test a thing and return result - No need to prefix with
get
- Past tense verbs