Skip to content

Commit

Permalink
Merge branch 'main' into fix/race
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 authored Jan 3, 2025
2 parents a054374 + 3d544c1 commit af75ce5
Show file tree
Hide file tree
Showing 18 changed files with 411 additions and 486 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i

* (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages.
* (client/keys) [#21829](https://github.com/cosmos/cosmos-sdk/pull/21829) Add support for importing hex key using standard input.
* (x/auth/ante) [#23128](https://github.com/cosmos/cosmos-sdk/pull/23128) Allow custom verifyIsOnCurve when validate tx for public key like ethsecp256k1.

### Improvements

Expand Down
2 changes: 1 addition & 1 deletion collections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Since a module can have multiple collections, the following is expected:
We don't want a collection to write over the state of the other collection so we pass it a prefix, which defines a storage
partition owned by the collection.

If you already built modules, the prefix translates to the items you were creating in your ``types/keys.go`` file, example: https://github.com/cosmos/cosmos-sdk/blob/main/x/feegrant/key.go#L27
If you already built modules, the prefix translates to the items you were creating in your ``types/keys.go`` file, example: https://github.com/cosmos/cosmos-sdk/blob/v0.52.0-rc.1/x/feegrant/key.go#L16~L22

your old:

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/adr-069-gov-improvements.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ Voter can only vote NO on the proposal. If the NO threshold is reached, the opti
Two governance parameters will be in added [`v1.Params`][5] to support optimistic proposals:

```protobuf
// optimistic_authorized_addreses is an optional governance parameter that limits the authorized accounts that can submit optimistic proposals
repeated string optimistic_authorized_addreses = 17 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// optimistic_authorized_addresses is an optional governance parameter that limits the authorized accounts that can submit optimistic proposals
repeated string optimistic_authorized_addresses = 17 [(cosmos_proto.scalar) = "cosmos.AddressString"];
// Optimistic rejected threshold defines at which percentage of NO votes, the optimistic proposal should fail and be converted to a standard proposal.
string optimistic_rejected_threshold = 18 [(cosmos_proto.scalar) = "cosmos.Dec"];
Expand Down
234 changes: 234 additions & 0 deletions server/v2/appmanager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
# AppManager Documentation

The AppManager serves as a high-level coordinator, delegating most operations to the STF while managing state access through the Store interface.

This document outlines the main external calls in the AppManager package, their execution flows, and dependencies.

## Table of Contents
- [InitGenesis](#initgenesis)
- [ExportGenesis](#exportgenesis)
- [DeliverBlock](#deliverblock)
- [ValidateTx](#validatetx)
- [Simulate](#simulate)
- [SimulateWithState](#simulatewithstate)
- [Query](#query)
- [QueryWithState](#querywithstate)

## InitGenesis

InitGenesis initializes the genesis state of the application.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant InitGenesisImpl
participant STF
participant State
Caller->>AppManager: InitGenesis(ctx, blockRequest, genesisJSON, decoder)
AppManager->>InitGenesisImpl: initGenesis(ctx, genesisJSON, txHandler)
loop For each genesis transaction
InitGenesisImpl->>InitGenesisImpl: Decode and collect transactions
end
InitGenesisImpl-->>AppManager: genesisState, validatorUpdates, error
AppManager->>STF: DeliverBlock(ctx, blockRequest, genesisState)
STF-->>AppManager: blockResponse, blockZeroState, error
AppManager->>State: Apply state changes
AppManager-->>Caller: blockResponse, genesisState, error
```

### Dependencies
- Required Input:
- Context
- BlockRequest
- Genesis JSON
- Transaction decoder
- Required Components:
- InitGenesis implementation
- STF
- Store interface

## ExportGenesis

ExportGenesis exports the current application state as genesis state.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant ExportGenesisImpl
Caller->>AppManager: ExportGenesis(ctx, version)
AppManager->>ExportGenesisImpl: exportGenesis(ctx, version)
ExportGenesisImpl-->>Caller: genesisJSON, error
```

### Dependencies
- Required Input:
- Context
- Version
- Required Components:
- ExportGenesis implementation
- Store interface


## DeliverBlock

DeliverBlock processes a block of transactions.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant Store
participant STF
Caller->>AppManager: DeliverBlock(ctx, block)
AppManager->>Store: StateLatest()
Store-->>AppManager: version, currentState, error
AppManager->>STF: DeliverBlock(ctx, block, currentState)
STF-->>Caller: blockResponse, newState, error
```


### Dependencies
- Required Input:
- Context
- BlockRequest
- Required Components:
- Store interface
- STF

## ValidateTx

ValidateTx validates a transaction against the latest state.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant Store
participant STF
Caller->>AppManager: ValidateTx(ctx, tx)
AppManager->>Store: StateLatest()
Store-->>AppManager: version, latestState, error
AppManager->>STF: ValidateTx(ctx, latestState, gasLimit, tx)
STF-->>Caller: TxResult, error
```


### Dependencies
- Required Input:
- Context
- Transaction
- Required Components:
- Store interface
- STF
- Configuration (for gas limits)

## Simulate

Simulate executes a transaction simulation using the latest state.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant Store
participant STF
Caller->>AppManager: Simulate(ctx, tx)
AppManager->>Store: StateLatest()
Store-->>AppManager: version, state, error
AppManager->>STF: Simulate(ctx, state, gasLimit, tx)
STF-->>Caller: TxResult, WriterMap, error
```

### Dependencies
- Required Input:
- Context
- Transaction
- Required Components:
- Store interface
- STF
- Configuration (for gas limits)

## SimulateWithState

SimulateWithState executes a transaction simulation using provided state.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant STF
Caller->>AppManager: SimulateWithState(ctx, state, tx)
AppManager->>STF: Simulate(ctx, state, gasLimit, tx)
STF-->>Caller: TxResult, WriterMap, error
```

### Dependencies
- Required Input:
- Context
- Transaction
- State

## Query

Query executes a query at a specific version.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant Store
participant STF
Caller->>AppManager: Query(ctx, version, request)
alt version == 0
AppManager->>Store: StateLatest()
else version > 0
AppManager->>Store: StateAt(version)
end
Store-->>AppManager: queryState, error
AppManager->>STF: Query(ctx, queryState, gasLimit, request)
STF-->>Caller: response, error
```

### Dependencies
- Required Input:
- Context
- Version (or 0 for latest)
- Query request
- Required Components:
- Store interface
- STF
- Configuration (for gas limits)

## QueryWithState

QueryWithState executes a query using provided state.

```mermaid
sequenceDiagram
participant Caller
participant AppManager
participant STF
Caller->>AppManager: QueryWithState(ctx, state, request)
AppManager->>STF: Query(ctx, state, gasLimit, request)
STF-->>Caller: response, error
```

### Dependencies
- Required Input:
- Context
- ReaderMap state
- Query request
- Required Components:
- STF
- Configuration (for gas limits)

## Common Dependencies

All operations depend on:
- Context management
- Error handling
- Gas metering
- State management (Store interface)
- STF interface
Loading

0 comments on commit af75ce5

Please sign in to comment.