cosmos-sdk/server/v2/stf
2024-10-08 09:26:14 +00:00
..
branch test(server/v2/stf): Add test for mergeiterator (#22141) 2024-10-08 09:26:14 +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 feat(server/v2): refactor the server/v2 events (#21785) 2024-09-18 15:37:13 +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 google.golang.org/protobuf from 1.34.2 to 1.35.1 (#22164) 2024-10-08 08:31:22 +00:00
go.sum build(deps): Bump google.golang.org/protobuf from 1.34.2 to 1.35.1 (#22164) 2024-10-08 08:31:22 +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 refactor(core/handlers): be more devx friendly (#21984) 2024-10-02 05:38:22 +00:00
stf_router.go refactor(core/handlers): be more devx friendly (#21984) 2024-10-02 05:38:22 +00:00
stf_test.go feat(server/v2/cometbft,stf): Listener integration in server/v2 (#21917) 2024-10-02 18:25:51 +00:00
stf.go feat(server/v2/cometbft,stf): Listener integration in server/v2 (#21917) 2024-10-02 18:25:51 +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.