Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
srene committed Sep 27, 2024
1 parent a4522e1 commit 1f62fce
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion contracts/callback-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ pub mod sudo {
}
```

Relevant test has been added as well in contract.rs and the default counter init/execute tests removed
Relevant test has been added as well in contract.rs and the default counter init/execute tests removed
12 changes: 10 additions & 2 deletions x/cwerrors/spec/01_state.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Section describes all stored by the module objects and their storage keys
The params value can only be updated by x/gov module via a governance upgrade proposal. [More](./02_messages.md#msgupdateparams)

Storage keys:

* Params: `ParamsKey -> ProtocolBuffer(Params)`

```protobuf
Expand All @@ -27,20 +28,23 @@ message Params {
ErrorID is a sequence number used to increment error ID.

Storage keys:

* ErrorID: `ErrorIDKey -> uint64`

## Contract Errors

Contract Errors is a collection of all the error ids associated with a given contract address. This is used to query contract errors.

Storage keys:

* ContractErrors: `ContractErrorsKeyPrefix | contractAddress | errorID -> errorID`

## Errors

Errors is a collections of all the [SudoErrors](../../../proto/rollapp/cwerrors/v1/cwerrors.proto) currently stored by the module which can be queried.

Storage keys:

* Errors: `ErrorsKeyPrefix | errorID -> protobuf(SudoError)`

```protobuf
Expand All @@ -63,25 +67,29 @@ message SudoError {
Deletion Blocks is a collection of all the error ids which need to be pruned in a given block height

Storage keys:

* DeletionBlocks: `DeletionBlocksKeyPrefix | blockHeight | errorID -> errorID`

## Contract Subscriptions

Contract Subscriptions is a map of the contract addresses which have subscriptions and the height when the subscription expires

Storage keys:

* Contract Subscriptions: `ContractSubscriptionsKeyPrefix | contractAddress -> deletionHeight`

## Subscription End Block

Subscritption End Block is a collections of all the subscriptions which need to be cleared at the given block height

Storage keys:

* Subscription End Block: `SubscriptionEndBlockKeyPrefix | blockHeight | contractAddress -> contractAddress`

# Transient State
## Transient State

The sudo errors which belong to the contracts with subscription are stored in the transient state of the block.

Transient Storage keys:
* SudoErrors: `ErrorsForSudoCallbackKey | errorId -> SudoError`

* SudoErrors: `ErrorsForSudoCallbackKey | errorId -> SudoError`
4 changes: 3 additions & 1 deletion x/cwerrors/spec/02_messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@ message MsgSubscribeToError {
```

On success

* A subscription is created valid for the duration as specified in the module params.
* The subscription fees are sent to the fee collector
* In case a subscription already exists, it is extended.

This message is expected to fail if:

* The sender address and contract address are not valid addresses
* There is no contract with given address
* The sender is not authorized to subscribe - the sender is not the contract owner/admin or the contract itself
* The user does not send enough funds or doesnt have enough funds
* The user does not send enough funds or doesnt have enough funds
2 changes: 1 addition & 1 deletion x/cwerrors/spec/04_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ The module emits the following proto-events
| Message | `MsgUpdateParams` | [ParamsUpdatedEvent](../../../proto/rollapp/cwerrors/v1/events.proto#L12) |
| Message | `MsgSubscribeToError` | [SubscribedToErrorsEvent](../../../proto/rollapp/cwerrors/v1/events.proto#L20) |
| Keeper | `SetErrorInState` | [StoringErrorEvent](../../../proto/rollapp/cwerrors/v1/events.proto#L32) |
| Module | `EndBlocker` | [SudoErrorCallbackFailedEvent](../../../proto/rollapp/cwerrors/v1/events.proto#L40) |
| Module | `EndBlocker` | [SudoErrorCallbackFailedEvent](../../../proto/rollapp/cwerrors/v1/events.proto#L40) |
5 changes: 2 additions & 3 deletions x/cwerrors/spec/05_client.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,14 @@ Use the `-h`/`--help` flag to get a help description of a command.

`rollapp-wasm tx cwerrors -h`


#### subscribe-to-error

Create a new subscription which will register a contract for a sudo callback on errors

Usage:
Usage:

`rollapp-wasm tx cwerrors subscribe-to-error [contract-address] [fee-amount] [flags]`

Example:

`rollapp-wasm tx cwerrors subscribe-to-error cosmos1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqukxvuk 7000stake --from myAccountKey`
`rollapp-wasm tx cwerrors subscribe-to-error cosmos1wug8sewp6cedgkmrmvhl3lf3tulagm9hnvy8p0rppz9yjw0g4wtqukxvuk 7000stake --from myAccountKey`
2 changes: 1 addition & 1 deletion x/cwerrors/spec/06_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ enum ModuleErrors {
// ERR_CALLBACK_EXECUTION_FAILED is the error code for when the error callback fails
ERR_CALLBACK_EXECUTION_FAILED = 1;
}
```
```

0 comments on commit 1f62fce

Please sign in to comment.