Skip to content

Commit

Permalink
bump cometbft
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Dec 11, 2024
1 parent 05f54b7 commit 6569fa1
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ replace (

// initia custom
replace (
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117
github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,8 @@ github.com/initia-labs/OPinit v0.6.1 h1:G9ebeYeqPlV9Z2s3JdSWfwQAUgIM+nhkcA8xSJUM
github.com/initia-labs/OPinit v0.6.1/go.mod h1:gDpCh4Zx94mihwgzP/PLav8eVHLroZBu3dFyzCy8iIs=
github.com/initia-labs/OPinit/api v0.6.0 h1:Q3hDHpTd9EqlDfY/OryCKIwuXYWJxGJdGfJicV1RjL4=
github.com/initia-labs/OPinit/api v0.6.0/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275 h1:kfOuFBZ09FVD7P75rXkpcm1nAh5mq5xNP6DXtPpOOiA=
github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117 h1:uELJfPYKLQvJTWN6bkFR63hvgpw8ROtSdQkXOUU+7IU=
github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e h1:k+pg63SFozCAK4LZFSiZtof6z69Tlu0O/Zftj1aAwes=
github.com/initia-labs/cometbft-client v0.0.0-20240924071428-ef115cefa07e/go.mod h1:aVposiPW9FOUeAeJ7JjJRdE3g+L6i8YDxFn6Cv6+Az4=
github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb h1:oyH9gg/4f7uMCIJYnSpp7wa1NrGjSMsXTtypUfrsPLU=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ replace (

// initia custom
replace (
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275
github.com/cometbft/cometbft => github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117
github.com/cosmos/ibc-go/v8 => github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d
github.com/ethereum/go-ethereum => github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1397,8 +1397,8 @@ github.com/initia-labs/OPinit v0.6.1 h1:G9ebeYeqPlV9Z2s3JdSWfwQAUgIM+nhkcA8xSJUM
github.com/initia-labs/OPinit v0.6.1/go.mod h1:gDpCh4Zx94mihwgzP/PLav8eVHLroZBu3dFyzCy8iIs=
github.com/initia-labs/OPinit/api v0.6.0 h1:Q3hDHpTd9EqlDfY/OryCKIwuXYWJxGJdGfJicV1RjL4=
github.com/initia-labs/OPinit/api v0.6.0/go.mod h1:gHK6DEWb3/DqQD5LjKirUx9jilAh2UioXanoQdgqVfU=
github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275 h1:kfOuFBZ09FVD7P75rXkpcm1nAh5mq5xNP6DXtPpOOiA=
github.com/initia-labs/cometbft v0.0.0-20241203094427-a9f2e56c0275/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117 h1:uELJfPYKLQvJTWN6bkFR63hvgpw8ROtSdQkXOUU+7IU=
github.com/initia-labs/cometbft v0.0.0-20241209060054-203460274117/go.mod h1:y7+6kPknafzWlkSMCekzXC81wpRf1pcVAUnO0wRy9lQ=
github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb h1:oyH9gg/4f7uMCIJYnSpp7wa1NrGjSMsXTtypUfrsPLU=
github.com/initia-labs/evm v0.0.0-20241108055119-3d312736d7fb/go.mod h1:+l/fr42Mma+xBnhefL/+z11/hcmJ2egl+ScIVPjhc7E=
github.com/initia-labs/ibc-go/v8 v8.0.0-20240802003717-19c0b4ad450d h1:TLq8lB1PtQ0pjGf+bN8YgGVeLMuytZ26SBGMOs1seKY=
Expand Down
11 changes: 11 additions & 0 deletions jsonrpc/namespaces/eth/filters/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ type FilterAPI struct {
// Channels for subscription managements
install chan *subscription // install filter for event notification
uninstall chan *subscription // remove filter for event notification
status chan chan int // get status of the subscriptions

// channels for block and log events
blockChan chan *coretypes.Header
Expand All @@ -77,6 +78,7 @@ func NewFilterAPI(ctx context.Context, app *app.MinitiaApp, backend *backend.JSO

install: make(chan *subscription),
uninstall: make(chan *subscription),
status: make(chan chan int),

filters: make(map[rpc.ID]*filter),
subscriptions: make(map[rpc.ID]*subscription),
Expand Down Expand Up @@ -165,6 +167,8 @@ func (api *FilterAPI) eventLoop() {
case s := <-api.uninstall:
delete(api.subscriptions, s.id)
close(s.err)
case ch := <-api.status:
ch <- len(api.subscriptions)

Check warning on line 171 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L170-L171

Added lines #L170 - L171 were not covered by tests
case <-api.ctx.Done():
return
}
Expand Down Expand Up @@ -485,6 +489,13 @@ func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
return []interface{}{}, errFilterNotFound
}

// NumSubscriptions returns the number of active subscriptions.
func (api *FilterAPI) NumSubscriptions() int {
ch := make(chan int)
api.status <- ch
return <-ch

Check warning on line 496 in jsonrpc/namespaces/eth/filters/api.go

View check run for this annotation

Codecov / codecov/patch

jsonrpc/namespaces/eth/filters/api.go#L493-L496

Added lines #L493 - L496 were not covered by tests
}

// returnLogs is a helper that will return an empty log array in case the given logs array is nil,
// otherwise the given logs array is returned.
func returnLogs(logs []*coretypes.Log) []*coretypes.Log {
Expand Down
2 changes: 1 addition & 1 deletion jsonrpc/namespaces/eth/filters/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func setupFilterAPI(t *testing.T) testInput {

cfg := config.DefaultJSONRPCConfig()
cfg.Enable = true
cfg.FilterTimeout = 3 * time.Second
cfg.FilterTimeout = 10 * time.Second

mockCometRPC := tests.NewMockCometRPC(app.BaseApp)
clientCtx = clientCtx.WithClient(mockCometRPC)
Expand Down

0 comments on commit 6569fa1

Please sign in to comment.