cosmos-sdk/server/v2/stf
dependabot[bot] 90d81f05c9
build(deps): Bump cosmossdk.io/core from 1.0.0-alpha.1 to 1.0.0-alpha.2 (#21698)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Julien Robert <julien@rbrt.fr>
2024-09-13 08:37:19 +00:00
..
branch fix(stf/branch/memiter): Fix Iter validity (#21556) 2024-09-09 08:37:59 +00:00
gas refactor(core,stf): complete gas service + simplify deps (#21166) 2024-08-08 07:30:09 +00:00
internal refactor(core): remove redundant ExecMode (#20322) 2024-05-29 16:27:07 +00:00
mock test(server/v2/cometbft): Add abci unit tests (#21020) 2024-09-09 10:34:29 +00:00
core_branch_service_test.go test(x/upgrade): fix tests (#21582) 2024-09-07 14:41:33 +00:00
core_branch_service.go feat: unify version modifier for v2 (#21508) 2024-09-06 15:56:29 +00:00
core_event_service.go fix(server/v2/stf): include safety checks to the execution context (#21359) 2024-08-23 10:22:17 +00:00
core_gas_service.go fix(server/v2/stf): include safety checks to the execution context (#21359) 2024-08-23 10:22:17 +00:00
core_header_service.go fix(server/v2/stf): include safety checks to the execution context (#21359) 2024-08-23 10:22:17 +00:00
core_router_service.go refactor(core,stf,x)!: remove InvokeTyped from router (#21224) 2024-08-23 21:38:06 +00:00
core_store_service.go fix(server/v2/stf): include safety checks to the execution context (#21359) 2024-08-23 10:22:17 +00:00
go.mod build(deps): Bump cosmossdk.io/core from 1.0.0-alpha.1 to 1.0.0-alpha.2 (#21698) 2024-09-13 08:37:19 +00:00
go.sum build(deps): Bump cosmossdk.io/core from 1.0.0-alpha.1 to 1.0.0-alpha.2 (#21698) 2024-09-13 08:37:19 +00:00
identity.go chore: cleanup core/app (#21368) 2024-08-27 09:55:16 +00:00
README.md refactor(core,stf): complete gas service + simplify deps (#21166) 2024-08-08 07:30:09 +00:00
stf_router_test.go docs(core): add core documentation and principles (#21511) 2024-09-03 22:20:05 +00:00
stf_router.go refactor(core): re-add handlers (#21575) 2024-09-09 09:01:46 +00:00
stf_test.go chore: cleanup core/app (#21368) 2024-08-27 09:55:16 +00:00
stf.go chore: cleanup core/app (#21368) 2024-08-27 09:55:16 +00:00
util_test.go fix(server/v2/stf): include safety checks to the execution context (#21359) 2024-08-23 10:22:17 +00:00
util.go refactor: use errors.New to replace fmt.Errorf with no parameters (#21394) 2024-08-25 11:41:31 +00:00

State Transition Function (STF)

STF is a function that takes a state and an action as input and returns the next state. It does not assume the execution model of the application nor consensus.

The state transition function receives a read only instance of state. It does not directly write to disk, instead it will return the state changes which has undergone within the application. The state transition function is deterministic, meaning that given the same input, it will always produce the same output.

BranchDB

BranchDB is a cache of all the reads done within a block, simulation or transaction validation. It takes a read-only instance of state and creates its own write instance using a btree. After all state transitions are done, the new change sets are returned to the caller.

The BranchDB can be replaced and optimized for specific use cases. The implementation is as follows

   type branchdb func(state store.ReaderMap) store.WriterMap

GasMeter

GasMeter is a utility that keeps track of the gas consumed by the state transition function. It is used to limit the amount of computation that can be done within a block.

The GasMeter can be replaced and optimized for specific use cases. The implementation is as follows:

type (
 // gasMeter is a function type that takes a gas limit as input and returns a gas.Meter.
 // It is used to measure and limit the amount of gas consumed during the execution of a function.
 gasMeter func(gasLimit uint64) gas.Meter

 // wrapGasMeter is a function type that wraps a gas meter and a store writer map.
 wrapGasMeter func(meter gas.Meter, store store.WriterMap) store.WriterMap
)

THe wrappGasMeter is used in order to consume gas. Application developers can seamlsessly replace the gas meter with their own implementation in order to customize consumption of gas.