Skip to content

Commit

Permalink
add begin/end-block info
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Sep 13, 2024
1 parent 99ce5a4 commit ae9c24a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 8 deletions.
32 changes: 28 additions & 4 deletions docs/docs/build/modules/02-provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,37 @@ message MsgSubmitConsumerDoubleVoting {
}
```

## Begin-Block
## BeginBlock

> TBA
In the `BeginBlock` of the provider module the following actions are performed:

## End-Block
- Launch every consumer chain that has a spawn time that already passed.
- Compute the initial validator set.
- Create the genesis state for the consumer module.
Note that the genesis state contains the [consumer module parameters](./03-consumer.md#parameters) and
both the client state and consensus state needed for creating a provider client on the consumer chain.
- Create a consumer client.
- Remove every stopped consumer chain for which the removal time has passed.
- Replenish the throttling meter if necessary.
- Distribute ICS rewards to the opted in validators.

> TBA
Note that for every consumer chain, the computation of its initial validator set is based on the consumer's [power shaping parameters](../../features/power-shaping.md)
and the [validators that opted in on that consumer](../../features/partial-set-security.md).

## EndBlock

In the `EndBlock` of the provider module the following actions are performed:

- Store in state the VSC id to block height mapping needed for determining the height of infractions on consumer chains.
- Prune the no-longer needed public keys assigned by validators to use when validating on consumer chains.
- Send validator updates to the consensus engine.
The maximum number of validators is set through the [MaxProviderConsensusValidators](#maxproviderconsensusvalidators) param.
- At the begining of every epoch,
- for every launched consumer chain, compute the next consumer validator set and send it to the consumer chain via an IBC packet;
- increment the VSC id.

Note that for every consumer chain, the computation of its validator set is based on the consumer's [power shaping parameters](../../features/power-shaping.md)
and the [validators that opted in on that consumer](../../features/partial-set-security.md).

## Hooks

Expand Down
18 changes: 14 additions & 4 deletions docs/docs/build/modules/03-consumer.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,23 @@ message MsgUpdateParams {
}
```

## Begin-Block
## BeginBlock

> TBA
In the `BeginBlock` of the consumer module the following actions are performed:

## End-Block
- Store in state the block height to VSC id mapping needed for sending to the provider the height of infractions committed on the consumer chain.
- Track historical entries. This is the same lofic as in the `x/staking` module.

> TBA
## EndBlock

In the `EndBlock` of the consumer module the following actions are performed:

- If `PreCCV` state is active, i.e., the consumer chain is a previously standalone chain
that was just upgraded to include the consumer module, then execute the [changeover logic](../../consumer-development/changeover-procedure.md).
- Otherwise, distribute block rewards internally and once every [BlocksPerDistributionTransmission](#blocksperdistributiontransmission) send
ICS rewards to the provider chain.
- Send slash packets to the provider chain reporting infractions validators commited on the consumer chain.
- Send to the consensus engine validator updates reveived from the provider chain.

## Hooks

Expand Down

0 comments on commit ae9c24a

Please sign in to comment.