Skip to content

Commit

Permalink
update the interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-develope committed Jun 20, 2024
1 parent bd65ac6 commit fbbe274
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions runtime/v2/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Store interface {
// state. Must error when the version does not exist.
StateAt(version uint64) (store.ReaderMap, error)

WorkingHash(changeset *store.Changeset) (store.Hash, error)
Commit(changeset *store.Changeset) (store.Hash, error)

// Query is a key/value query directly to the underlying database. This skips the appmanager
Expand Down
3 changes: 0 additions & 3 deletions scripts/simapp-v2-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ jq '.app_state.gov.voting_params.voting_period = "600s"' genesis.json > temp.jso
# to change the inflation
jq '.app_state.mint.minter.inflation = "0.300000000000000000"' genesis.json > temp.json && mv temp.json genesis.json

# change the initial height to 2 to work around store/v2 and iavl limitations with a genesis block
jq '.initial_height = 2' genesis.json > temp.json && mv temp.json genesis.json

$SIMD keys add test_validator --indiscreet
VALIDATOR_ADDRESS=$($SIMD keys show test_validator -a --keyring-backend test)

Expand Down
2 changes: 1 addition & 1 deletion server/v2/cometbft/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ func (c *Consensus[T]) InitChain(ctx context.Context, req *abciproto.InitChainRe
cs := &store.Changeset{
Changes: stateChanges,
}
stateRoot, err := c.store.Commit(cs)
stateRoot, err := c.store.WorkingHash(cs)
if err != nil {
return nil, fmt.Errorf("unable to commit the changeset: %w", err)
}
Expand Down
4 changes: 4 additions & 0 deletions server/v2/cometbft/types/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ type Store interface {
// associated with it.
StateLatest() (uint64, store.ReaderMap, error)

// WorkingHash writes the provided changeset to the state and returns
// the working hash of the state.
WorkingHash(*store.Changeset) (store.Hash, error)

// Commit commits the provided changeset and returns
// the new state root of the state.
Commit(*store.Changeset) (store.Hash, error)
Expand Down

0 comments on commit fbbe274

Please sign in to comment.