From 6569fa1bc4b676a1de5b7ecdd2b58b1139c5831c Mon Sep 17 00:00:00 2001 From: beer-1 Date: Wed, 11 Dec 2024 12:22:09 +0900 Subject: [PATCH] bump cometbft --- go.mod | 2 +- go.sum | 4 ++-- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 ++-- jsonrpc/namespaces/eth/filters/api.go | 11 +++++++++++ jsonrpc/namespaces/eth/filters/api_test.go | 2 +- 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c4568383..c271ed8a 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index dec22bc0..4247f472 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index ba70ebd4..01c1c5f4 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -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 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index e063ff23..21f233da 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -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= diff --git a/jsonrpc/namespaces/eth/filters/api.go b/jsonrpc/namespaces/eth/filters/api.go index 3c016045..0baa2bec 100644 --- a/jsonrpc/namespaces/eth/filters/api.go +++ b/jsonrpc/namespaces/eth/filters/api.go @@ -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 @@ -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), @@ -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) case <-api.ctx.Done(): return } @@ -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 +} + // 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 { diff --git a/jsonrpc/namespaces/eth/filters/api_test.go b/jsonrpc/namespaces/eth/filters/api_test.go index 21210383..f33166b0 100644 --- a/jsonrpc/namespaces/eth/filters/api_test.go +++ b/jsonrpc/namespaces/eth/filters/api_test.go @@ -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)