Skip to content

Commit

Permalink
chore: bump go-header, go-fraud and celestia-openrpc (rollkit#1166)
Browse files Browse the repository at this point in the history
Depends on celestiaorg/celestia-openrpc#43

---------

Co-authored-by: Manav Aggarwal <[email protected]>
  • Loading branch information
2 people authored and chandiniv1 committed Sep 25, 2023
1 parent 01f4541 commit 3e2f352
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 189 deletions.
2 changes: 1 addition & 1 deletion da/celestia/celestia.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (c *DataAvailabilityLayerClient) SubmitBlocks(ctx context.Context, blocks [
blobs[blockIndex] = blockBlob
}

dataLayerHeight, err := c.rpc.Blob.Submit(ctx, blobs)
dataLayerHeight, err := c.rpc.Blob.Submit(ctx, blobs, openrpc.DefaultSubmitOptions())
if err != nil {
return da.ResultSubmitBlocks{
BaseResult: da.BaseResult{
Expand Down
6 changes: 3 additions & 3 deletions da/celestia/mock/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,11 @@ func (s *Server) rpc(w http.ResponseWriter, r *http.Request) {
s.writeError(w, err)
return
}
if len(params) != 1 {
s.writeError(w, errors.New("expected 1 param: data (base64 string)"))
if len(params) != 2 {
s.writeError(w, errors.New("expected 2 params: data (base64 string) and options (map[string]interface{})"))
return
}

// ignores the second parameter - options
blocks := make([]*types.Block, len(params[0].([]interface{})))
for i, data := range params[0].([]interface{}) {
blockBase64 := data.(map[string]interface{})["data"].(string)
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ module github.com/rollkit/rollkit
go 1.20

require (
github.com/celestiaorg/go-header v0.2.13
github.com/celestiaorg/nmt v0.18.1
github.com/celestiaorg/rsmt2d v0.10.0
github.com/celestiaorg/go-header v0.3.1
github.com/celestiaorg/nmt v0.19.0
github.com/celestiaorg/rsmt2d v0.11.0
github.com/celestiaorg/utils v0.1.0
github.com/cometbft/cometbft v0.37.2
github.com/creachadair/taskgroup v0.6.0
Expand All @@ -23,7 +23,7 @@ require (
github.com/libp2p/go-libp2p-pubsub v0.9.3
github.com/multiformats/go-multiaddr v0.11.0
github.com/prometheus/client_golang v1.16.0
github.com/rollkit/celestia-openrpc v0.1.2
github.com/rollkit/celestia-openrpc v0.2.0
github.com/rs/cors v1.9.0
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
Expand All @@ -36,12 +36,12 @@ require (
)

require (
cosmossdk.io/math v1.0.1 // indirect
cosmossdk.io/math v1.1.2 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
github.com/celestiaorg/go-fraud v0.1.2 // indirect
github.com/celestiaorg/go-fraud v0.2.0 // indirect
github.com/celestiaorg/go-libp2p-messenger v0.2.0 // indirect
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
Expand Down Expand Up @@ -101,7 +101,7 @@ require (
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/klauspost/reedsolomon v1.11.1 // indirect
github.com/klauspost/reedsolomon v1.11.8 // indirect
github.com/koron/go-ssdp v0.0.4 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-cidranger v1.1.0 // indirect
Expand Down
28 changes: 14 additions & 14 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
contrib.go.opencensus.io/exporter/stackdriver v0.13.4/go.mod h1:aXENhDJ1Y4lIg4EUaVTwzvYETVNZk10Pu26tevFKLUc=
cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg=
cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k=
cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM=
cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0=
dmitri.shuralyov.com/app/changes v0.0.0-20180602232624-0a106ad413e3/go.mod h1:Yl+fi1br7+Rr3LqpNJf1/uxUdtRUV+Tnj0o93V2B9MU=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
dmitri.shuralyov.com/html/belt v0.0.0-20180602232347-f7d459c86be0/go.mod h1:JLBrvjyP0v+ecvNYvCpyZgu5/xkfAUhi6wJj28eUfSU=
Expand Down Expand Up @@ -190,18 +190,18 @@ github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7
github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc=
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
github.com/casbin/casbin/v2 v2.37.0/go.mod h1:vByNa/Fchek0KZUgG5wEsl7iFsiviAYKRtgrQfcJqHg=
github.com/celestiaorg/go-fraud v0.1.2 h1:Bf7yIN3lZ4IR/Vlu5OtmcVCVNESBKEJ/xwu28rRKGA8=
github.com/celestiaorg/go-fraud v0.1.2/go.mod h1:kHZXQY+6gd1kYkoWRFFKgWyrLPWRgDN3vd1Ll9gE/oo=
github.com/celestiaorg/go-header v0.2.13 h1:sUJLXYs8ViPpxLXyIIaW3h4tPFgtVYMhzsLC4GHfS8I=
github.com/celestiaorg/go-header v0.2.13/go.mod h1:NhiWq97NtAYyRBu8quzYOUghQULjgOzO2Ql0iVEFOf0=
github.com/celestiaorg/go-fraud v0.2.0 h1:aaq2JiW0gTnhEdac3l51UCqSyJ4+VjFGTTpN83V4q7I=
github.com/celestiaorg/go-fraud v0.2.0/go.mod h1:lNY1i4K6kUeeE60Z2VK8WXd+qXb8KRzfBhvwPkK6aUc=
github.com/celestiaorg/go-header v0.3.1 h1:rJuFPVMoI20Du4KHWLz0IMllEIp0XgIWi9lHQLPWmq8=
github.com/celestiaorg/go-header v0.3.1/go.mod h1:H8xhnDLDLbkpwmWPhCaZyTnIV3dlVxBHPnxNXS2Qu6c=
github.com/celestiaorg/go-libp2p-messenger v0.2.0 h1:/0MuPDcFamQMbw9xTZ73yImqgTO3jHV7wKHvWD/Irao=
github.com/celestiaorg/go-libp2p-messenger v0.2.0/go.mod h1:s9PIhMi7ApOauIsfBcQwbr7m+HBzmVfDIS+QLdgzDSo=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc=
github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA=
github.com/celestiaorg/nmt v0.18.1 h1:zU3apzW4y0fs0ilQA74XnEYW8FvRv0CUK2LXK66L3rA=
github.com/celestiaorg/nmt v0.18.1/go.mod h1:0l8q6UYRju1xNrxtvV6NwPdW3lfsN6KuZ0htRnModdc=
github.com/celestiaorg/rsmt2d v0.10.0 h1:8dprr6CW5mCk5YPnbiLdirojw9YsJOE+XB+GORb8sT0=
github.com/celestiaorg/rsmt2d v0.10.0/go.mod h1:BiCZkCJfhDHUEOJKXUeu+CudjluecKvRTqHcuxKvodc=
github.com/celestiaorg/nmt v0.19.0 h1:9VXFeI/gt+q8h5HeCE0RjXJhOxsFzxJUjHrkvF9CMYE=
github.com/celestiaorg/nmt v0.19.0/go.mod h1:Oz15Ub6YPez9uJV0heoU4WpFctxazuIhKyUtaYNio7E=
github.com/celestiaorg/rsmt2d v0.11.0 h1:lcto/637WyTEZR3dLRoNvyuExfnUbxvdvKi3qz/2V4k=
github.com/celestiaorg/rsmt2d v0.11.0/go.mod h1:6Y580I3gVr0+OVFfW6m2JTwnCCmvW3WfbwSLfuT+HCA=
github.com/celestiaorg/utils v0.1.0 h1:WsP3O8jF7jKRgLNFmlDCwdThwOFMFxg0MnqhkLFVxPo=
github.com/celestiaorg/utils v0.1.0/go.mod h1:vQTh7MHnvpIeCQZ2/Ph+w7K1R2UerDheZbgJEJD2hSU=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
Expand Down Expand Up @@ -790,8 +790,8 @@ github.com/klauspost/cpuid/v2 v2.0.12/go.mod h1:g2LTdtYhdyuGPqyWyv7qRAmj1WBqxuOb
github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs=
github.com/klauspost/reedsolomon v1.11.1 h1:0gCWQXOB8pVe1Y5SGozDA5t2qoVxX3prsV+qHgI/Fik=
github.com/klauspost/reedsolomon v1.11.1/go.mod h1:FXLZzlJIdfqEnQLdUKWNRuMZg747hZ4oYp2Ml60Lb/k=
github.com/klauspost/reedsolomon v1.11.8 h1:s8RpUW5TK4hjr+djiOpbZJB4ksx+TdYbRH7vHQpwPOY=
github.com/klauspost/reedsolomon v1.11.8/go.mod h1:4bXRN+cVzMdml6ti7qLouuYi32KHJ5MGv0Qd8a47h6A=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
Expand Down Expand Up @@ -1349,8 +1349,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rollkit/celestia-openrpc v0.1.2 h1:EglDzgTLVF8JT+szvvRJ3cyZIliRQWf0+OJZjdksr1s=
github.com/rollkit/celestia-openrpc v0.1.2/go.mod h1:rAnRxt1XXLPBCIcZ5M1RWbXLlg8IrYFOXFmyNgn2148=
github.com/rollkit/celestia-openrpc v0.2.0 h1:miSxBgiKtDBZk0dUgreAMubIPXU/Qtf9Q36+E7yZdeE=
github.com/rollkit/celestia-openrpc v0.2.0/go.mod h1:0fNIcIMbG0ZceCoh4tINNhuzhmebUMDV0cJqZboe/wg=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/rs/cors v1.9.0 h1:l9HGsTsHJcvW14Nk7J9KFz8bzeAWXn3CG6bgt7LsrAE=
Expand Down
2 changes: 1 addition & 1 deletion node/block_exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (bExService *BlockExchangeService) initBlockStoreAndStartSyncer(ctx context
// Note: Only returns an error in case block store can't be initialized. Logs error if there's one while broadcasting.
func (bExService *BlockExchangeService) writeToBlockStoreAndBroadcast(ctx context.Context, block *types.Block) error {
// For genesis block initialize the store and start the syncer
if block.Height() == bExService.genesis.InitialHeight {
if int64(block.Height()) == bExService.genesis.InitialHeight {
if err := bExService.blockStore.Init(ctx, block); err != nil {
return fmt.Errorf("failed to initialize block store")
}
Expand Down
4 changes: 2 additions & 2 deletions node/full_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -738,11 +738,11 @@ func (c *FullClient) Status(ctx context.Context) (*ctypes.ResultStatus, error) {
SyncInfo: ctypes.SyncInfo{
LatestBlockHash: cmbytes.HexBytes(latest.SignedHeader.DataHash),
LatestAppHash: cmbytes.HexBytes(latest.SignedHeader.AppHash),
LatestBlockHeight: latest.Height(),
LatestBlockHeight: int64(latest.Height()),
LatestBlockTime: latest.Time(),
EarliestBlockHash: cmbytes.HexBytes(initial.SignedHeader.DataHash),
EarliestAppHash: cmbytes.HexBytes(initial.SignedHeader.AppHash),
EarliestBlockHeight: initial.Height(),
EarliestBlockHeight: int64(initial.Height()),
EarliestBlockTime: initial.Time(),
CatchingUp: true, // the client is always syncing in the background to the latest height
},
Expand Down
6 changes: 3 additions & 3 deletions node/full_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func TestGetCommit(t *testing.T) {
}
t.Run("Fetch all commits", func(t *testing.T) {
for _, b := range blocks {
h := b.Height()
h := int64(b.Height())
commit, err := rpc.Commit(context.Background(), &h)
require.NoError(err)
require.NotNil(commit)
Expand All @@ -414,7 +414,7 @@ func TestGetCommit(t *testing.T) {
commit, err := rpc.Commit(context.Background(), nil)
require.NoError(err)
require.NotNil(commit)
assert.Equal(blocks[3].Height(), commit.Height)
assert.Equal(int64(blocks[3].Height()), commit.Height)
})
}

Expand Down Expand Up @@ -496,7 +496,7 @@ func TestGetBlockByHash(t *testing.T) {
abciBlock, err := abciconv.ToABCIBlock(block)
require.NoError(err)

height := block.Height()
height := int64(block.Height())
retrievedBlock, err := rpc.Block(context.Background(), &height)
require.NoError(err)
require.NotNil(retrievedBlock)
Expand Down
3 changes: 2 additions & 1 deletion node/header_exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (hExService *HeaderExchangeService) initHeaderStoreAndStartSyncer(ctx conte
// Note: Only returns an error in case header store can't be initialized. Logs error if there's one while broadcasting.
func (hExService *HeaderExchangeService) writeToHeaderStoreAndBroadcast(ctx context.Context, signedHeader *types.SignedHeader) error {
// For genesis header initialize the store and start the syncer
if signedHeader.Height() == hExService.genesis.InitialHeight {
if int64(signedHeader.Height()) == hExService.genesis.InitialHeight {
if err := hExService.headerStore.Init(ctx, signedHeader); err != nil {
return fmt.Errorf("failed to initialize header store")
}
Expand Down Expand Up @@ -220,6 +220,7 @@ func newP2PExchange(
goheaderp2p.WithNetworkID[goheaderp2p.ClientParameters](network),
goheaderp2p.WithChainID(chainID),
)

return goheaderp2p.NewExchange[*types.SignedHeader](host, peers, conngater, opts...)
}

Expand Down
14 changes: 7 additions & 7 deletions state/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (e *BlockExecutor) updateState(state types.State, block *types.Block, abciR
}
}
// Change results from this height but only applies to the next next height.
lastHeightValSetChanged = block.Height() + 1 + 1
lastHeightValSetChanged = int64(block.Height()) + 1 + 1
}

if len(nValSet.Validators) > 0 {
Expand All @@ -218,7 +218,7 @@ func (e *BlockExecutor) updateState(state types.State, block *types.Block, abciR
Version: state.Version,
ChainID: state.ChainID,
InitialHeight: state.InitialHeight,
LastBlockHeight: block.Height(),
LastBlockHeight: int64(block.Height()),
LastBlockTime: block.Time(),
LastBlockID: cmtypes.BlockID{
Hash: cmbytes.HexBytes(block.Hash()),
Expand Down Expand Up @@ -270,10 +270,10 @@ func (e *BlockExecutor) validate(state types.State, block *types.Block) error {
block.SignedHeader.Version.Block != state.Version.Consensus.Block {
return errors.New("block version mismatch")
}
if state.LastBlockHeight <= 0 && block.Height() != state.InitialHeight {
if state.LastBlockHeight <= 0 && int64(block.Height()) != state.InitialHeight {
return errors.New("initial block height mismatch")
}
if state.LastBlockHeight > 0 && block.Height() != state.LastBlockHeight+1 {
if state.LastBlockHeight > 0 && int64(block.Height()) != state.LastBlockHeight+1 {
return errors.New("block height mismatch")
}
if !bytes.Equal(block.SignedHeader.AppHash[:], state.AppHash[:]) {
Expand Down Expand Up @@ -341,7 +341,7 @@ func (e *BlockExecutor) execute(ctx context.Context, state types.State, block *t
}

}
endBlockRequest := abci.RequestEndBlock{Height: block.Height()}
endBlockRequest := abci.RequestEndBlock{Height: int64(block.Height())}
abciResponses.EndBlock, err = e.proxyApp.EndBlockSync(endBlockRequest)
if err != nil {
return nil, err
Expand Down Expand Up @@ -375,13 +375,13 @@ func (e *BlockExecutor) publishEvents(resp *cmstate.ABCIResponses, block *types.
for _, ev := range abciBlock.Evidence.Evidence {
err = multierr.Append(err, e.eventBus.PublishEventNewEvidence(cmtypes.EventDataNewEvidence{
Evidence: ev,
Height: block.Height(),
Height: int64(block.Height()),
}))
}
for i, dtx := range resp.DeliverTxs {
err = multierr.Append(err, e.eventBus.PublishEventTx(cmtypes.EventDataTx{
TxResult: abci.TxResult{
Height: block.Height(),
Height: int64(block.Height()),
Index: uint32(i),
Tx: abciBlock.Data.Txs[i],
Result: *dtx,
Expand Down
8 changes: 4 additions & 4 deletions state/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ func doTestCreateBlock(t *testing.T) {
block := executor.CreateBlock(1, &types.Commit{}, []byte{}, state)
require.NotNil(block)
assert.Empty(block.Data.Txs)
assert.Equal(int64(1), block.Height())
assert.Equal(uint64(1), block.Height())

// one small Tx
err = mpool.CheckTx([]byte{1, 2, 3, 4}, func(r *abci.Response) {}, mempool.TxInfo{})
require.NoError(err)
block = executor.CreateBlock(2, &types.Commit{}, []byte{}, state)
require.NotNil(block)
assert.Equal(int64(2), block.Height())
assert.Equal(uint64(2), block.Height())
assert.Len(block.Data.Txs, 1)

// now there are 3 Txs, and only two can fit into single block
Expand Down Expand Up @@ -158,7 +158,7 @@ func doTestApplyBlock(t *testing.T) {
require.NoError(err)
block := executor.CreateBlock(1, &types.Commit{Signatures: []types.Signature{types.Signature([]byte{1, 1, 1})}}, []byte{}, state)
require.NotNil(block)
assert.Equal(int64(1), block.Height())
assert.Equal(uint64(1), block.Height())
assert.Len(block.Data.Txs, 1)

// Update the signature on the block to current from last
Expand All @@ -184,7 +184,7 @@ func doTestApplyBlock(t *testing.T) {
require.NoError(mpool.CheckTx(make([]byte, 90), func(r *abci.Response) {}, mempool.TxInfo{}))
block = executor.CreateBlock(2, &types.Commit{Signatures: []types.Signature{types.Signature([]byte{1, 1, 1})}}, []byte{}, newState)
require.NotNil(block)
assert.Equal(int64(2), block.Height())
assert.Equal(uint64(2), block.Height())
assert.Len(block.Data.Txs, 3)

headerBytes, _ = block.SignedHeader.Header.MarshalBinary()
Expand Down
30 changes: 4 additions & 26 deletions types/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@ package types
import (
"encoding"
"errors"

"fmt"
"time"

cmbytes "github.com/cometbft/cometbft/libs/bytes"

"github.com/celestiaorg/go-header"
cmtypes "github.com/cometbft/cometbft/types"
)

Expand Down Expand Up @@ -51,15 +48,6 @@ type Commit struct {
Signatures []Signature // most of the time this is a single signature
}

// SignedHeader combines Header and its Commit.
//
// Used mostly for gossiping.
type SignedHeader struct {
Header
Commit Commit
Validators *cmtypes.ValidatorSet
}

// Signature represents signature of block creator.
type Signature []byte

Expand Down Expand Up @@ -94,7 +82,7 @@ func (c *Commit) ToABCICommit(height int64, hash Hash) *cmtypes.Commit {
}

func (c *Commit) GetCommitHash(header *Header, proposerAddress []byte) []byte {
lastABCICommit := c.ToABCICommit(header.Height(), header.Hash())
lastABCICommit := c.ToABCICommit(int64(header.Height()), header.Hash())
// Rollkit does not support a multi signature scheme so there can only be one signature
if len(c.Signatures) == 1 {
lastABCICommit.Signatures[0].ValidatorAddress = proposerAddress
Expand Down Expand Up @@ -128,7 +116,7 @@ func (b *Block) ValidateBasic() error {
return nil
}

func (b *Block) New() header.Header {
func (b *Block) New() *Block {
return new(Block)
}

Expand All @@ -140,7 +128,7 @@ func (b *Block) ChainID() string {
return b.SignedHeader.ChainID() + "-block"
}

func (b *Block) Height() int64 {
func (b *Block) Height() uint64 {
return b.SignedHeader.Height()
}

Expand All @@ -152,18 +140,8 @@ func (b *Block) Time() time.Time {
return b.SignedHeader.Time()
}

func (b *Block) Verify(untrst header.Header) error {
func (b *Block) Verify(*Block) error {
//TODO: Update with new header verify method
untrstB, ok := untrst.(*Block)
if !ok {
// if the header type is wrong, something very bad is going on
// and is a programmer bug
panic(fmt.Errorf("%T is not of type %T", untrst, &b))
}
// sanity check fields
if err := verifyNewHeaderAndVals(&b.SignedHeader.Header, &untrstB.SignedHeader.Header); err != nil {
return &header.VerifyError{Reason: err}
}
return nil
}

Expand Down
Loading

0 comments on commit 3e2f352

Please sign in to comment.