Skip to content

Commit

Permalink
docs: update authz docs with pruning details (#14957)
Browse files Browse the repository at this point in the history
(cherry picked from commit 21378e3)
  • Loading branch information
atheeshp authored and mergify[bot] committed Feb 8, 2023
1 parent 4700f9c commit 2606a21
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/authz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/proto/cosmos/authz/v1beta1

We are maintaining a queue for authz pruning. Whenever a grant is created, an item will be added to `GrantQueue` with a key of expiration, granter, grantee.

In `EndBlock` (which runs for every block) we continuously check and prune the expired grants by forming a prefix key with current blocktime that passed the stored expiration in `GrantQueue`, we iterate through all the matched records from `GrantQueue` and delete them from the `GrantQueue` & `Grant`s store.

```go reference
https://github.com/cosmos/cosmos-sdk/blob/5f4ddc6f80f9707320eec42182184207fff3833a/x/authz/keeper/keeper.go#L378-L403
```

* GrantQueue: `0x02 | expiration_bytes | granter_address_len (1 byte) | granter_address_bytes | grantee_address_len (1 byte) | grantee_address_bytes -> ProtocalBuffer(GrantQueueItem)`

The `expiration_bytes` are the expiration date in UTC with the format `"2006-01-02T15:04:05.000000000"`.
Expand Down

0 comments on commit 2606a21

Please sign in to comment.