Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make rdk compatible with tendermint #1115

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ func (app *BaseApp) Commit() (res abci.ResponseCommit) {
commitID := app.cms.Commit()
app.logger.Info("commit synced", "commit", fmt.Sprintf("%X", commitID))

// Reset the Check state to the latest committed.
//
// NOTE: This is safe because Tendermint holds a lock on the mempool for
// Commit. Use the header from this latest block.
app.setCheckState(header)

// empty/reset the deliver state
app.deliverState = nil

Expand Down
18 changes: 18 additions & 0 deletions baseapp/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ func TestBaseAppBeginBlockConsensusParams(t *testing.T) {
require.Equal(t, maxGas, newCtx.ConsensusParams().Block.MaxGas)
}

func TestBaseAppCheckStateUpdated(t *testing.T) {
t.Parallel()

logger := defaultLogger()
db := dbm.NewMemDB()
name := t.Name()
app := NewBaseApp(name, logger, db, nil)
app.init()

// block exec
for i := 1; i <= 10; i++ {
app.BeginBlock(abci.RequestBeginBlock{Header: tmproto.Header{Height: int64(i)}})
app.Commit()
}

require.Equal(t, int64(10), app.checkState.ctx.BlockHeight())
}

type paramStore struct {
db *dbm.MemDB
}
Expand Down
28 changes: 14 additions & 14 deletions demo/test_sequencer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,18 @@ else
echo "send failed..."
fi

## NOTE: There is a bug in the current Ramus that only validators can execute tx.
# ${L2BINARYNAME} keys add bob --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test
# sleep 1
# BOB_ADDR=$(${L2BINARYNAME} keys show bob -a --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test)
# echo $ALICE_ADDR
# ${L2BINARYNAME} tx bank send $ALICE_ADDR $BOB_ADDR 10stake --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test --chain-id $L2_CHAIN_ID -y
# sleep 30
# NOTE: There is a bug in the current Ramus that only validators can execute tx.
${L2BINARYNAME} keys add bob --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test
sleep 1
BOB_ADDR=$(${L2BINARYNAME} keys show bob -a --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test)
echo $ALICE_ADDR
${L2BINARYNAME} tx bank send $ALICE_ADDR $BOB_ADDR 10stake --home $L2_KEYRING_DIR/$SEQUENCER_DIR --keyring-backend=test --chain-id $L2_CHAIN_ID -y
sleep 30

# # Check alice's balance
# BALANCE=$(${L2BINARYNAME} query bank balances $BOB_ADDR --home $L2_KEYRING_DIR/$SEQUENCER_DIR --output json | jq -r '.balances[0].amount')
# if [ 10 -eq ${BALANCE} ]; then
# echo "send success!"
# else
# echo "send failed..."
# fi
# Check alice's balance
BALANCE=$(${L2BINARYNAME} query bank balances $BOB_ADDR --home $L2_KEYRING_DIR/$SEQUENCER_DIR --output json | jq -r '.balances[0].amount')
if [ 10 -eq ${BALANCE} ]; then
echo "send success!"
else
echo "send failed..."
fi