Skip to content
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: 3 additions & 3 deletions .github/workflows/integration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
EVNODE_VERSION: "v1.0.0-beta.2.0.20250818133040-d096a24e7052"
EVNODE_VERSION: "v1.0.0-beta.2.0.20250901092248-017d6d45a621"
IGNITE_VERSION: "v29.3.1"
IGNITE_EVOLVE_APP_VERSION: "main" # use tagged when apps has tagged (blocked on things)
EVOLVE_IMAGE_REPO: "evolve-gm"
Expand Down Expand Up @@ -59,7 +59,7 @@ jobs:
timeout-minutes: 30
env:
DO_NOT_TRACK: true
EVNODE_VERSION: "v1.0.0-beta.2.0.20250818133040-d096a24e7052"
EVNODE_VERSION: "v1.0.0-beta.2.0.20250901092248-017d6d45a621"
IGNITE_VERSION: "v29.3.1"
IGNITE_EVOLVE_APP_VERSION: "main" # use tagged when apps has tagged (blocked on things)
outputs:
Expand Down Expand Up @@ -266,7 +266,7 @@ jobs:
GMD_HOME: ${{ needs.liveness.outputs.gmd_home }}
HERMES_VERSION: "v1.13.1"
GAIA_VERSION: "v25.1.0"
EVNODE_VERSION: "v1.0.0-beta.2.0.20250818133040-d096a24e7052"
EVNODE_VERSION: "v1.0.0-beta.2.0.20250901092248-017d6d45a621"
EVNODE_DA_VERSION: "v1.0.0-beta.1"
steps:
- name: Set up Go
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/migration_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 45
env:
DO_NOT_TRACK: true
EVNODE_VERSION: "v1.0.0-beta.2.0.20250818133040-d096a24e7052"
EVNODE_VERSION: "v1.0.0-beta.2.0.20250901092248-017d6d45a621"
IGNITE_VERSION: "v29.3.1"
IGNITE_EVOLVE_APP_VERSION: "main" # use tagged when apps has tagged (blocked on things)
steps:
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 EVNODE_VERSION=v1.0.0-beta.2.0.20250818133040-d096a24e7052
ENV EVNODE_VERSION=v1.0.0-beta.2.0.20250901092248-017d6d45a621
ENV IGNITE_VERSION=v29.3.1
ENV IGNITE_EVOLVE_APP_VERSION=main

Expand Down
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ require (
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.14
github.com/cosmos/gogoproto v1.7.0
github.com/evstack/ev-node v1.0.0-beta.2.0.20250818133040-d096a24e7052
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250818133040-d096a24e7052
github.com/evstack/ev-node/da v0.0.0-20250818133040-d096a24e7052
github.com/evstack/ev-node/sequencers/single v0.0.0-20250818133040-d096a24e7052
github.com/evstack/ev-node v1.0.0-beta.2.0.20250901092248-017d6d45a621
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250901092248-017d6d45a621
github.com/evstack/ev-node/da v0.0.0-20250901092248-017d6d45a621
github.com/evstack/ev-node/sequencers/single v0.0.0-20250901092248-017d6d45a621
github.com/go-kit/kit v0.13.0
github.com/golang/protobuf v1.5.4
github.com/grpc-ecosystem/grpc-gateway v1.16.0
Expand Down
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/evstack/ev-node v1.0.0-beta.2.0.20250818133040-d096a24e7052 h1:Fsu6gkxsANYfl/AgDEABDN7dmeEXCIcFSPgFKTHZEwA=
github.com/evstack/ev-node v1.0.0-beta.2.0.20250818133040-d096a24e7052/go.mod h1:LEP7bA5MA8+khDuZWmJcg8K8KXQ5jJVLTSETggQbrV0=
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250818133040-d096a24e7052 h1:FhMa6ZiUSPSq4EeQXAheS6+7vaOSika3eDgSQiTbMJk=
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250818133040-d096a24e7052/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
github.com/evstack/ev-node/da v0.0.0-20250818133040-d096a24e7052 h1:aHPY3amXzULbIn7M5lslwo3lz9w89gP04wbLNa/k/LI=
github.com/evstack/ev-node/da v0.0.0-20250818133040-d096a24e7052/go.mod h1:ooBV3tAL2o9brFql9I4DKgoDP4BchF3aMrUDR4ARC/k=
github.com/evstack/ev-node/sequencers/single v0.0.0-20250818133040-d096a24e7052 h1:PDM62mPdhXDkOU8RZkBbw7ALKVtXpvgZPYNjfJEwnQc=
github.com/evstack/ev-node/sequencers/single v0.0.0-20250818133040-d096a24e7052/go.mod h1:ll3+DmIF9X5mgyNhT/BaMZBVkS9bPDaq7tWHCqwtdkA=
github.com/evstack/ev-node v1.0.0-beta.2.0.20250901092248-017d6d45a621 h1:c3CM78SnNlQoYqzzYaUTpBAR/FK7JDfS0gd9fTRGe2E=
github.com/evstack/ev-node v1.0.0-beta.2.0.20250901092248-017d6d45a621/go.mod h1:jY/c+EkBt8G8srFBTpKuHrxioLYNLgDn1lFMktITA5Q=
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250901092248-017d6d45a621 h1:BXfwY70MP9Amivmcs8bWeXZzmOx8dE6Re9jbsKv+YbI=
github.com/evstack/ev-node/core v1.0.0-beta.1.0.20250901092248-017d6d45a621/go.mod h1:n2w/LhYQTPsi48m6lMj16YiIqsaQw6gxwjyJvR+B3sY=
github.com/evstack/ev-node/da v0.0.0-20250901092248-017d6d45a621 h1:nuv0sVhGhjkoF50iKGfi56XwkvlqcKKW1l19MG1Y3LA=
github.com/evstack/ev-node/da v0.0.0-20250901092248-017d6d45a621/go.mod h1:ooBV3tAL2o9brFql9I4DKgoDP4BchF3aMrUDR4ARC/k=
github.com/evstack/ev-node/sequencers/single v0.0.0-20250901092248-017d6d45a621 h1:WvaJVarlm+UQXclO86Fl/xMldJrquIGH6SBR6Fsapng=
github.com/evstack/ev-node/sequencers/single v0.0.0-20250901092248-017d6d45a621/go.mod h1:I9phdwpqEQjkvZVnhf3dvh4wozbiZ2BLY3cwCFxzT08=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
Expand Down
41 changes: 17 additions & 24 deletions pkg/adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import (
rstore "github.com/evstack/ev-node/pkg/store"
"github.com/evstack/ev-node/types"

"github.com/evstack/ev-abci/pkg/cometcompat"
"github.com/evstack/ev-abci/pkg/p2p"
execstore "github.com/evstack/ev-abci/pkg/store"
)
Expand Down Expand Up @@ -326,11 +325,21 @@ func (a *Adapter) ExecuteTxs(
return nil, 0, fmt.Errorf("get last commit: %w", err)
}

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

cmtTxs := make(cmttypes.Txs, len(txs))
for i := range txs {
cmtTxs[i] = txs[i]
}

abciBlock, currentBlockID, err := MakeABCIBlock(blockHeight, cmtTxs, s, abciHeader, lastCommit)
if err != nil {
return nil, 0, err
}

ppResp, err := a.App.ProcessProposal(&abci.RequestProcessProposal{
Hash: abciHeader.Hash(),
Height: int64(blockHeight),
Expand Down Expand Up @@ -448,26 +457,10 @@ func (a *Adapter) ExecuteTxs(
if err != nil {
return nil, 0, err
}
cmtTxs := make(cmttypes.Txs, len(txs))
for i := range txs {
cmtTxs[i] = txs[i]
}

abciBlock := 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: abciHeader.Hash(),
PartSetHeader: blockParts.Header(),
}
// saving data to ev-abci store

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

Expand Down Expand Up @@ -497,13 +490,13 @@ func (a *Adapter) ExecuteTxs(
func fireEvents(
eventBus cmttypes.BlockEventPublisher,
block *cmttypes.Block,
blockID cmttypes.BlockID,
blockID *cmttypes.BlockID,
abciResponse *abci.ResponseFinalizeBlock,
validatorUpdates []*cmttypes.Validator,
) error {
if err := eventBus.PublishEventNewBlock(cmttypes.EventDataNewBlock{
Block: block,
BlockID: blockID,
BlockID: *blockID,
ResultFinalizeBlock: *abciResponse,
}); err != nil {
return fmt.Errorf("publish new block event: %w", err)
Expand Down Expand Up @@ -618,14 +611,14 @@ func cometCommitToABCICommitInfo(commit *cmttypes.Commit) abci.CommitInfo {
}

type StackedEvent struct {
blockID cmttypes.BlockID
blockID *cmttypes.BlockID
block *cmttypes.Block
abciResponse *abci.ResponseFinalizeBlock
validatorUpdates []*cmttypes.Validator
}

func (a *Adapter) stackBlockCommitEvents(
blockID cmttypes.BlockID,
blockID *cmttypes.BlockID,
block *cmttypes.Block,
abciResponse *abci.ResponseFinalizeBlock,
validatorUpdates []*cmttypes.Validator,
Expand Down
3 changes: 1 addition & 2 deletions pkg/adapter/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (

"github.com/evstack/ev-node/types"

"github.com/evstack/ev-abci/pkg/cometcompat"
execstore "github.com/evstack/ev-abci/pkg/store"
)

Expand Down Expand Up @@ -104,7 +103,7 @@ func TestExecuteFiresEvents(t *testing.T) {
AppHash: []byte("apphash1"),
}

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

sig, err := privKey.Sign(headerBz)
Expand Down
34 changes: 33 additions & 1 deletion pkg/cometcompat/convert.go → pkg/adapter/convert.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package cometcompat
package adapter

import (
"errors"
"fmt"

cmbytes "github.com/cometbft/cometbft/libs/bytes"
cmprotoversion "github.com/cometbft/cometbft/proto/tendermint/version"
cmtstate "github.com/cometbft/cometbft/state"
cmttypes "github.com/cometbft/cometbft/types"
cmtversion "github.com/cometbft/cometbft/version"

Expand Down Expand Up @@ -74,3 +75,34 @@ func ToABCIBlockMeta(abciBlock *cmttypes.Block) (*cmttypes.BlockMeta, error) {
NumTxs: len(abciBlock.Txs),
}, nil
}

// MakeABCIBlock makes an ABCI block and its block ID.
func MakeABCIBlock(
blockHeight uint64,
cmtTxs cmttypes.Txs,
currentState *cmtstate.State,
abciHeader cmttypes.Header,
lastCommit *cmttypes.Commit,
) (*cmttypes.Block, *cmttypes.BlockID, error) {
abciBlock := currentState.MakeBlock(
int64(blockHeight),
cmtTxs,
lastCommit,
nil,
currentState.Validators.Proposer.Address,
)

blockParts, err := abciBlock.MakePartSet(cmttypes.BlockPartSizeBytes)
if err != nil {
return nil, nil, 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: abciHeader.Hash(),
PartSetHeader: blockParts.Header(),
}

return abciBlock, currentBlockID, nil
}
123 changes: 123 additions & 0 deletions pkg/adapter/providers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
package adapter

import (
"bytes"
"context"
stdsha256 "crypto/sha256"
"encoding/hex"
"fmt"

tmcryptoed25519 "github.com/cometbft/cometbft/crypto/ed25519"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmttypes "github.com/cometbft/cometbft/types"
"github.com/libp2p/go-libp2p/core/crypto"

evtypes "github.com/evstack/ev-node/types"
)

func AggregatorNodeSignatureBytesProvider(adapter *Adapter) evtypes.AggregatorNodeSignatureBytesProvider {
return func(header *evtypes.Header) ([]byte, error) {
blockID, err := adapter.Store.GetBlockID(context.Background(), header.Height())
if err != nil && header.Height() > 1 {
return nil, err
}

return createVote(header, blockID), nil
}
}

func SyncNodeSignatureBytesProvider(adapter *Adapter) evtypes.SyncNodeSignatureBytesProvider {
return func(ctx context.Context, header *evtypes.Header, data *evtypes.Data) ([]byte, error) {
blockHeight := header.Height()
blockID := &cmttypes.BlockID{}

if header.Height() > 1 { // first block has an empty block ID
cmtTxs := make(cmttypes.Txs, len(data.Txs))
for i := range data.Txs {
cmtTxs[i] = cmttypes.Tx(data.Txs[i])
}

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

abciHeader, err := ToABCIHeader(*header, lastCommit)
if err != nil {
return nil, fmt.Errorf("compute header hash: %w", err)
}

currentState, err := adapter.Store.LoadState(ctx)
if err != nil {
return nil, fmt.Errorf("load state: %w", err)
}

_, blockID, err = MakeABCIBlock(blockHeight, cmtTxs, currentState, abciHeader, lastCommit)
if err != nil {
return nil, fmt.Errorf("make ABCI block: %w", err)
}
}

return createVote(header, blockID), nil
}
}

// createVote builds the vote for the given header and block ID to be signed.
func createVote(header *evtypes.Header, blockID *cmttypes.BlockID) []byte {
vote := cmtproto.Vote{
Type: cmtproto.PrecommitType,
Height: int64(header.Height()), //nolint:gosec
BlockID: blockID.ToProto(),
Round: 0,
Timestamp: header.Time(),
ValidatorAddress: header.ProposerAddress,
ValidatorIndex: 0,
}

chainID := header.ChainID()
consensusVoteBytes := cmttypes.VoteSignBytes(chainID, &vote)

return consensusVoteBytes
}

// ValidatorHasher returns a function that calculates the ValidatorHash
// compatible with CometBFT. This function is intended to be injected into ev-node's Manager.
func ValidatorHasherProvider() func(proposerAddress []byte, pubKey crypto.PubKey) (evtypes.Hash, error) {
return func(proposerAddress []byte, pubKey crypto.PubKey) (evtypes.Hash, error) {
var calculatedHash evtypes.Hash

var cometBftPubKey tmcryptoed25519.PubKey
if pubKey.Type() == crypto.Ed25519 {
rawKey, err := pubKey.Raw()
if err != nil {
return calculatedHash, fmt.Errorf("failed to get raw bytes from libp2p public key: %w", err)
}
if len(rawKey) != tmcryptoed25519.PubKeySize {
return calculatedHash, fmt.Errorf("libp2p public key size (%d) does not match CometBFT Ed25519 PubKeySize (%d)", len(rawKey), tmcryptoed25519.PubKeySize)
}
cometBftPubKey = rawKey
} else {
return calculatedHash, fmt.Errorf("unsupported public key type '%s', expected Ed25519 for CometBFT compatibility", pubKey.Type())
}

votingPower := int64(1)
sequencerValidator := cmttypes.NewValidator(cometBftPubKey, votingPower)

derivedAddress := sequencerValidator.Address.Bytes()
if !bytes.Equal(derivedAddress, proposerAddress) {
return calculatedHash, fmt.Errorf("CRITICAL MISMATCH - derived validator address (%s) does not match expected proposer address (%s). PubKey used for derivation: %s",
hex.EncodeToString(derivedAddress),
hex.EncodeToString(proposerAddress),
hex.EncodeToString(cometBftPubKey.Bytes()))
}

sequencerValidatorSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{sequencerValidator})

hashSumBytes := sequencerValidatorSet.Hash()

calculatedHash = make(evtypes.Hash, stdsha256.Size)
copy(calculatedHash, hashSumBytes)

return calculatedHash, nil
}
}
Loading
Loading