Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
10338eb
refactor: simplify getting abci block
julienrbrt Jul 18, 2025
e0534a2
fix serialization
julienrbrt Jul 18, 2025
90462e7
get current commit
julienrbrt Jul 18, 2025
ec58e8f
updates
julienrbrt Jul 18, 2025
70f0014
fix endpoint
julienrbrt Jul 18, 2025
f66989a
always fill in part set header, and return non cannonical commit
julienrbrt Jul 18, 2025
07c63ec
include correct block id
julienrbrt Jul 18, 2025
afe71ec
fix some tests and bump rollkit
julienrbrt Jul 18, 2025
fa15f1f
updates
julienrbrt Jul 19, 2025
e5f37e2
attempt
julienrbrt Jul 21, 2025
6d4a629
fix block id
julienrbrt Jul 21, 2025
61a78f1
split store
julienrbrt Jul 21, 2025
ee39bc8
nil signatures at genesis
julienrbrt Jul 21, 2025
5a33909
fix current block id
julienrbrt Jul 21, 2025
7eca06b
attempt
julienrbrt Jul 21, 2025
9d15f5e
add save block id
julienrbrt Jul 22, 2025
40e47fe
remove store last commit
julienrbrt Jul 22, 2025
42efffb
simplify
julienrbrt Jul 22, 2025
5c5cbc1
updates
julienrbrt Jul 22, 2025
fb95a87
bump rollkit
julienrbrt Jul 22, 2025
9f2aa85
use main
julienrbrt Jul 22, 2025
adb5964
fix: Fix TestBlockSearch_Success by adding missing mock calls and Blo…
Copilot Jul 22, 2025
2aa071b
updates
julienrbrt Jul 22, 2025
999db83
test: add more tests (#198)
Copilot Jul 23, 2025
5cfe071
Merge branch 'main' into julien/ibc-impr
julienrbrt Jul 23, 2025
746a6b0
fixes
julienrbrt Jul 23, 2025
43c2346
updates
julienrbrt Jul 24, 2025
9a59e31
use header hash in block id
julienrbrt Jul 24, 2025
e3128c2
fix light verify test
julienrbrt Jul 24, 2025
d2524eb
Merge branch 'main' into julien/ibc-impr
julienrbrt Jul 24, 2025
46eefdb
bump to rollkit v1.0.0-beta.2
julienrbrt Jul 24, 2025
e9a89d4
fix
julienrbrt Jul 24, 2025
39d582f
missing gh action variable
julienrbrt Jul 24, 2025
b33802c
add env correct place
julienrbrt Jul 24, 2025
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
13 changes: 7 additions & 6 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

concurrency:
Expand All @@ -17,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
ROLLKIT_VERSION: "v1.0.0-beta.1"
ROLLKIT_VERSION: "v1.0.0-beta.2"
IGNITE_VERSION: "v29.2.0"
ROLLKIT_IMAGE_REPO: "rollkit-gm"
ROLLKIT_IMAGE_TAG: "latest"
Expand Down Expand Up @@ -58,7 +57,8 @@ jobs:
timeout-minutes: 30
env:
DO_NOT_TRACK: true
ROLLKIT_VERSION: "v1.0.0-beta.1"
ROLLKIT_VERSION: "v1.0.0-beta.2"
ROLLKIT_DA_VERSION: "v1.0.0-beta.1"
IGNITE_VERSION: "v29.2.0"
outputs:
carol_mnemonic: ${{ steps.save_mnemonic.outputs.carol_mnemonic }}
Expand All @@ -81,7 +81,7 @@ jobs:

- name: Start Local DA
run: |
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_VERSION
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_DA_VERSION
# start the local da in the background
local-da &
# capture the background process PID
Expand Down Expand Up @@ -264,7 +264,8 @@ jobs:
GMD_HOME: ${{ needs.liveness.outputs.gmd_home }}
HERMES_VERSION: "v1.13.1"
CEL_VERSION: "v4.0.3-arabica"
ROLLKIT_VERSION: "v1.0.0-beta.1"
ROLLKIT_VERSION: "v1.0.0-beta.2"
ROLLKIT_DA_VERSION: "v1.0.0-beta.1"

steps:
- name: Set up Go
Expand Down Expand Up @@ -305,7 +306,7 @@ jobs:

- name: Start Local DA
run: |
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_VERSION
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_DA_VERSION
# start the local da in the background
local-da &
# capture the background process PID
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/migration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

jobs:
Expand All @@ -14,7 +13,8 @@ jobs:
timeout-minutes: 45
env:
DO_NOT_TRACK: true
ROLLKIT_VERSION: "v1.0.0-beta.1"
ROLLKIT_VERSION: "v1.0.0-beta.2"
ROLLKIT_DA_VERSION: "v1.0.0-beta.1"
IGNITE_VERSION: "v29.2.0"
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -200,7 +200,7 @@ jobs:

- name: Start Local DA for Rollkit
run: |
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_VERSION
go install github.com/rollkit/rollkit/da/cmd/local-da@$ROLLKIT_DA_VERSION
# start the local da in the background
local-da &
# capture the background process PID
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache \
bash

# Set environment variables
ENV ROLLKIT_VERSION=v1.0.0-beta.1
ENV ROLLKIT_VERSION=v1.0.0-beta.2
ENV IGNITE_VERSION=v29.2.0

RUN curl -sSL https://get.ignite.com/cli@${IGNITE_VERSION}! | bash
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ require (
github.com/libp2p/go-libp2p-pubsub v0.14.2
github.com/multiformats/go-multiaddr v0.16.0
github.com/prometheus/client_golang v1.22.0
github.com/rollkit/rollkit v1.0.0-beta.1
github.com/rollkit/rollkit v1.0.0-beta.2
github.com/rollkit/rollkit/core v1.0.0-beta.1
github.com/rollkit/rollkit/da v1.0.0-beta.1
github.com/rollkit/rollkit/sequencers/single v1.0.0-beta.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/rollkit/rollkit v1.0.0-beta.1 h1:d9Wkb5XgMtIdbsYm+hOoFdc+AcX0fI7ram0X3iREOUc=
github.com/rollkit/rollkit v1.0.0-beta.1/go.mod h1:sjDcpuc+djvPmhaDf0+CFJZ5mCuselDnh21H+e7gv6o=
github.com/rollkit/rollkit v1.0.0-beta.2 h1:g9NISvSWLkFzoGufVxDAofRd4gweRewTtqW8RASW5Ss=
github.com/rollkit/rollkit v1.0.0-beta.2/go.mod h1:6OYfH1dYTOhqg+bCMxvkrb4qe7SruYoSup5zxQNyrKs=
github.com/rollkit/rollkit/core v1.0.0-beta.1 h1:lAcFWOTUaNGDWEDIjVv07FWizJswBsF3JWi9jEScV7k=
github.com/rollkit/rollkit/core v1.0.0-beta.1/go.mod h1:0RhbqC8Is970KRhr6zPUQOZkmKt6/WqPRDQWfd2P7P0=
github.com/rollkit/rollkit/da v1.0.0-beta.1 h1:MjN845kIsuRpisgnPJ2d3zuF6aN/uzOaiy/FCtJL7i0=
Expand Down
76 changes: 40 additions & 36 deletions pkg/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"cosmossdk.io/log"
abci "github.com/cometbft/cometbft/abci/types"
cmtcfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/libs/bytes"
"github.com/cometbft/cometbft/mempool"
corep2p "github.com/cometbft/cometbft/p2p"
cmtprototypes "github.com/cometbft/cometbft/proto/tendermint/types"
Expand All @@ -34,6 +33,7 @@ import (

"github.com/rollkit/go-execution-abci/pkg/cometcompat"
"github.com/rollkit/go-execution-abci/pkg/p2p"
execstore "github.com/rollkit/go-execution-abci/pkg/store"
)

var _ execution.Executor = &Adapter{}
Expand Down Expand Up @@ -72,7 +72,7 @@ func LoadGenesisDoc(cfg *cmtcfg.Config) (*cmttypes.GenesisDoc, error) {
// Adapter is a struct that will contain an ABCI Application, and will implement the go-execution interface
type Adapter struct {
App servertypes.ABCI
Store *Store
Store *execstore.Store
RollkitStore rstore.Store
Mempool mempool.Mempool
MempoolIDs *mempoolIDs
Expand Down Expand Up @@ -108,7 +108,7 @@ func NewABCIExecutor(
})
rollkitStore := rstore.New(rollkitPrefixStore)

abciStore := NewExecABCIStore(store)
abciStore := execstore.NewExecABCIStore(store)

a := &Adapter{
App: app,
Expand Down Expand Up @@ -316,23 +316,23 @@ func (a *Adapter) ExecuteTxs(
return nil, 0, fmt.Errorf("load state: %w", err)
}

header, ok := types.SignedHeaderFromContext(ctx)
header, ok := types.HeaderFromContext(ctx)
if !ok {
return nil, 0, fmt.Errorf("rollkit header not found in context")
}

lastCommit, err := a.getLastCommit(ctx, blockHeight)
lastCommit, err := a.GetLastCommit(ctx, blockHeight)
if err != nil {
return nil, 0, fmt.Errorf("get last commit: %w", err)
}

emptyBlock, err := cometcompat.ToABCIBlock(header, &types.Data{}, lastCommit)
abciHeader, err := cometcompat.ToABCIHeader(header, lastCommit)
if err != nil {
return nil, 0, fmt.Errorf("compute header hash: %w", err)
}

ppResp, err := a.App.ProcessProposal(&abci.RequestProcessProposal{
Hash: emptyBlock.Header.Hash(),
Hash: abciHeader.Hash(),
Height: int64(blockHeight),
Time: timestamp,
Txs: txs,
Expand All @@ -350,16 +350,13 @@ func (a *Adapter) ExecuteTxs(
}

fbResp, err := a.App.FinalizeBlock(&abci.RequestFinalizeBlock{
Hash: emptyBlock.Header.Hash(),
Hash: abciHeader.Hash(),
NextValidatorsHash: s.NextValidators.Hash(),
ProposerAddress: s.Validators.Proposer.Address,
Height: int64(blockHeight),
Time: timestamp,
DecidedLastCommit: abci.CommitInfo{
Round: 0,
Votes: nil,
},
Txs: txs,
DecidedLastCommit: cometCommitToABCICommitInfo(lastCommit),
Txs: txs,
})
if err != nil {
return nil, 0, err
Expand Down Expand Up @@ -456,34 +453,35 @@ func (a *Adapter) ExecuteTxs(
cmtTxs[i] = txs[i]
}

if blockHeight == 0 {
lastCommit.Signatures = []cmttypes.CommitSig{
{
BlockIDFlag: cmttypes.BlockIDFlagCommit,
ValidatorAddress: s.Validators.Proposer.Address,
Timestamp: time.Now().UTC(),
Signature: []byte{},
},
}
}
abciBlock := s.MakeBlock(int64(blockHeight), cmtTxs, lastCommit, nil, s.Validators.Proposer.Address)

block := s.MakeBlock(int64(blockHeight), cmtTxs, lastCommit, nil, s.Validators.Proposer.Address)
blockParts, err := abciBlock.MakePartSet(cmttypes.BlockPartSizeBytes)
if err != nil {
return nil, 0, fmt.Errorf("make part set: %w", err)
}

// use abci header hash to match the light client validation check
// where sh.Header.Hash() (comet header) must equal sh.Commit.BlockID.Hash
currentBlockID := cmttypes.BlockID{
Hash: block.Hash(),
PartSetHeader: cmttypes.PartSetHeader{Total: 1, Hash: block.DataHash},
Hash: abciHeader.Hash(),
PartSetHeader: blockParts.Header(),
}

if err := a.Store.SaveBlockID(ctx, blockHeight, &currentBlockID); err != nil {
return nil, 0, fmt.Errorf("save block ID: %w", err)
}

if a.blockFilter.IsPublishable(ctx, int64(header.Height())) {
// save response before the events are fired (current behaviour in CometBFT)
if err := a.Store.SaveBlockResponse(ctx, blockHeight, fbResp); err != nil {
return nil, 0, fmt.Errorf("save block response: %w", err)
}
if err := fireEvents(a.EventBus, block, currentBlockID, fbResp, validatorUpdates); err != nil {

if err := fireEvents(a.EventBus, abciBlock, currentBlockID, fbResp, validatorUpdates); err != nil {
return nil, 0, fmt.Errorf("fire events: %w", err)
}
} else {
a.stackBlockCommitEvents(currentBlockID, block, fbResp, validatorUpdates)
a.stackBlockCommitEvents(currentBlockID, abciBlock, fbResp, validatorUpdates)
// clear events so that they are not stored with the block data at this stage.
fbResp.Events = nil
if err := a.Store.SaveBlockResponse(ctx, blockHeight, fbResp); err != nil {
Expand All @@ -492,6 +490,7 @@ func (a *Adapter) ExecuteTxs(
}

a.Logger.Info("block executed successfully", "height", blockHeight, "appHash", fmt.Sprintf("%X", fbResp.AppHash))

return fbResp.AppHash, uint64(s.ConsensusParams.Block.MaxBytes), nil
}

Expand Down Expand Up @@ -556,17 +555,23 @@ func fireEvents(
return nil
}

func (a *Adapter) getLastCommit(ctx context.Context, blockHeight uint64) (*cmttypes.Commit, error) {
// GetLastCommit retrieves the last commit for the given block height.
func (a *Adapter) GetLastCommit(ctx context.Context, blockHeight uint64) (*cmttypes.Commit, error) {
if blockHeight > 1 {
header, data, err := a.RollkitStore.GetBlockData(ctx, blockHeight-1)
header, err := a.RollkitStore.GetHeader(ctx, blockHeight-1)
if err != nil {
return nil, fmt.Errorf("get previous block data: %w", err)
}

blockID, err := a.Store.GetBlockID(ctx, blockHeight-1)
if err != nil {
return nil, fmt.Errorf("get previous block ID: %w", err)
}

commitForPrevBlock := &cmttypes.Commit{
Height: int64(header.Height()),
Round: 0,
BlockID: cmttypes.BlockID{Hash: bytes.HexBytes(header.Hash()), PartSetHeader: cmttypes.PartSetHeader{Total: 1, Hash: bytes.HexBytes(data.Hash())}},
BlockID: *blockID,
Signatures: []cmttypes.CommitSig{
{
BlockIDFlag: cmttypes.BlockIDFlagCommit,
Expand All @@ -581,10 +586,9 @@ func (a *Adapter) getLastCommit(ctx context.Context, blockHeight uint64) (*cmtty
}

return &cmttypes.Commit{
Height: int64(blockHeight),
Round: 0,
BlockID: cmttypes.BlockID{},
Signatures: []cmttypes.CommitSig{},
Height: 0,
Round: 0,
BlockID: cmttypes.BlockID{},
}, nil
}

Expand All @@ -601,7 +605,7 @@ func cometCommitToABCICommitInfo(commit *cmttypes.Commit) abci.CommitInfo {
votes[i] = abci.VoteInfo{
Validator: abci.Validator{
Address: sig.ValidatorAddress,
Power: 0,
Power: 1,
},
BlockIdFlag: cmtprototypes.BlockIDFlag(sig.BlockIDFlag),
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/adapter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/rollkit/rollkit/types"

"github.com/rollkit/go-execution-abci/pkg/cometcompat"
execstore "github.com/rollkit/go-execution-abci/pkg/store"
)

func TestExecuteFiresEvents(t *testing.T) {
Expand Down Expand Up @@ -98,12 +99,12 @@ func TestExecuteFiresEvents(t *testing.T) {
val := cmtypes.NewValidator(cometBftPubKey, 1)

header := types.Header{
BaseHeader: types.BaseHeader{Height: 2, Time: uint64(time.Now().UnixNano())},
BaseHeader: types.BaseHeader{Height: 1, Time: uint64(time.Now().UnixNano())},
ProposerAddress: val.Address,
AppHash: []byte("apphash1"),
}

headerBz, err := cometcompat.PayloadProvider()(&header)
headerBz, err := cometcompat.SignaturePayloadProvider(adapter.Store)(&header)
require.NoError(t, err)

sig, err := privKey.Sign(headerBz)
Expand All @@ -118,10 +119,10 @@ func TestExecuteFiresEvents(t *testing.T) {
Signature: sig,
}
require.NoError(t, adapter.RollkitStore.SaveBlockData(ctx, signedHeader, &types.Data{Txs: make(types.Txs, 0)}, &sigT))
require.NoError(t, adapter.Store.SaveState(ctx, stateFixture()))
require.NoError(t, adapter.Store.SaveState(ctx, execstore.TestingStateFixture()))

// when
ctx = context.WithValue(ctx, types.SignedHeaderContextKey, signedHeader)
ctx = context.WithValue(ctx, types.HeaderContextKey, signedHeader.Header)
_, _, err = adapter.ExecuteTxs(ctx, spec.txs, 1, timestamp, bytes.Repeat([]byte{1}, 32))
if spec.expErr {
require.Error(t, err)
Expand Down
Loading
Loading