Skip to content

Commit

Permalink
Feature/ implement SubstrateIBCHeader (cosmos#986)
Browse files Browse the repository at this point in the history
* feat: add SubstrateIBCHeader type and implementation

* fix: ibctest go mod tidy

* feature/ implement substrate event parser (cosmos#923)

* feat: implement substrate event parser

* fix: event parser switch fallthrough

* fix: go-schnorrkel version fix

* fix: go mod update for dcokertest

* create helper functions between substrate <> ibc events

* use intoIBCEventType

* fix: event parser accumulation support

* fix: spearate parsing and handling of ibc messages

* feat: parachain header parse

* fix: packet accumulator separate switch case

* fix: go.mod docker issue

* fix: ics11-beefy repo version fix

* fix: accumulator events to messages

* fix: add connection event type conversion

* fix: ibctest go.mod fix

Co-authored-by: Blas Rodriguez Irizar <rodrigblas@gmail.com>

Co-authored-by: Blas Rodriguez Irizar <rodrigblas@gmail.com>
  • Loading branch information
2 people authored and oshorefueled committed Oct 20, 2022
1 parent f127c8b commit 3d9eb91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
11 changes: 5 additions & 6 deletions relayer/chains/substrate/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"time"

rpcclient "github.com/ComposableFi/go-substrate-rpc-client/v4"
beefyclienttypes "github.com/ComposableFi/ics11-beefy/types"
sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types"
Expand Down Expand Up @@ -93,6 +94,8 @@ type SubstrateProvider struct {
}

type SubstrateIBCHeader struct {
height uint64
SignedHeader *beefyclienttypes.Header
}

// noop to implement processor.IBCHeader
Expand All @@ -102,15 +105,11 @@ func (h SubstrateIBCHeader) IBCHeaderIndicator() {
}

func (h SubstrateIBCHeader) Height() uint64 {
//TODO implement me
panic("implement me")
return 0
return h.height
}

func (h SubstrateIBCHeader) ConsensusState() ibcexported.ConsensusState {
//TODO implement me
panic("implement me")
return nil
return h.SignedHeader.ConsensusState()
}

func (sp *SubstrateProvider) BlockTime(ctx context.Context, height int64) (time.Time, error) {
Expand Down
9 changes: 4 additions & 5 deletions relayer/chains/substrate/substrate_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,10 @@ func (scp *SubstrateChainProcessor) queryCycle(ctx context.Context, persistence

latestHeader = ibcHeader.(SubstrateIBCHeader)

// TODO: update latest bolock
// scp.latestBlock = provider.LatestBlock{
// Height: heightUint64,
// Time: latestHeader.SignedHeader.Time,
// }
scp.latestBlock = provider.LatestBlock{
Height: heightUint64,
Time: latestHeader.SignedHeader.ConsensusState().Timestamp,
}

ibcHeaderCache[heightUint64] = latestHeader
ppChanged = true
Expand Down

0 comments on commit 3d9eb91

Please sign in to comment.