Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d451fd2
add: READ_REQUEST event
Aman035 Jul 28, 2026
7c6f3c5
temp: proto results, will be replaced by core implementation
Aman035 Jul 28, 2026
d4bbe62
temp: pushCore fetch, to be replaced by core grpc fn
Aman035 Jul 28, 2026
4ebd946
temp: readResult temp vote, to be replace by core impl
Aman035 Jul 28, 2026
a11aff8
feat(uclient): evm/svm read query execution
Aman035 Jul 28, 2026
7eede40
feat(uclient): route read requests to target chains and vote results
Aman035 Jul 28, 2026
808f459
merged origin
Aman035 Jul 28, 2026
04ca9d5
remove docs
Aman035 Jul 28, 2026
9f674dc
change proto to hve targetChain
Aman035 Jul 28, 2026
01830ba
refactor(uclient): route external events via ChainClient.AddEvent
Aman035 Jul 28, 2026
e996af6
refactor(uclient): fold chain_reader.go into event_processor and types
Aman035 Jul 28, 2026
56a3209
test(uclient): cover evm/svm read executors via json-rpc fakes
Aman035 Jul 28, 2026
d4691e7
fix: temp types
Aman035 Aug 3, 2026
8c7d171
fix: pushWatcher acc to types
Aman035 Aug 3, 2026
c503e8a
fix: add read event to pushchain db
Aman035 Aug 3, 2026
4f822fc
fix: move type to client
Aman035 Aug 3, 2026
7212d2e
fix: read req handling
Aman035 Aug 3, 2026
03ebd48
refactor: naming changes
Aman035 Aug 3, 2026
5958d43
refactor: remove unused fn
Aman035 Aug 3, 2026
9b3cbf9
refactor: observation event processor
Aman035 Aug 3, 2026
b4d539a
refactor: observeration events
Aman035 Aug 3, 2026
3afc24c
add: web2 read handler
Aman035 Aug 4, 2026
6d6f773
fix: harden reads
Aman035 Aug 4, 2026
ab74a70
plug web2 read executor
Aman035 Aug 4, 2026
803c37d
remove: getERC20 bal - can be done by contract calls
Aman035 Aug 5, 2026
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
22 changes: 12 additions & 10 deletions universalClient/core/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ type UniversalClient struct {
pushCore *pushcore.Client
pushSigner *pushsigner.Signer
chains *externalchains.Chains
pushChain *pushwatcher.Client
pushWatcher *pushwatcher.Client
tssNode *tss.Node
}

Expand Down Expand Up @@ -70,21 +70,23 @@ func NewUniversalClient(ctx context.Context, cfg *config.Config) (*UniversalClie

chainsManager := externalchains.NewChains(pushCore, pushSigner, cfg, log)

// Push chain DB is shared by the push chain client and the TSS node.
// Push chain DB is shared by the push watcher and the TSS node.
pushDB, err := openPushDB(cfg)
if err != nil {
return nil, err
}

pushChain, err := pushwatcher.NewClient(
pushWatcher, err := pushwatcher.NewClient(
pushDB,
cfg.GetChainConfig(cfg.PushChainID),
pushCore,
cfg.PushChainID,
log,
pushSigner,
chainsManager,
)
if err != nil {
return nil, fmt.Errorf("failed to create push chain client: %w", err)
return nil, fmt.Errorf("failed to create push watcher: %w", err)
}

tssNode, err := initTSS(ctx, cfg, pushCore, chainsManager, pushSigner, pushDB, log)
Expand All @@ -102,7 +104,7 @@ func NewUniversalClient(ctx context.Context, cfg *config.Config) (*UniversalClie
pushCore: pushCore,
pushSigner: pushSigner,
chains: chainsManager,
pushChain: pushChain,
pushWatcher: pushWatcher,
tssNode: tssNode,
}, nil
}
Expand Down Expand Up @@ -130,8 +132,8 @@ func (uc *UniversalClient) Start() error {
return fmt.Errorf("failed to start chains manager: %w", err)
}

if err := uc.pushChain.Start(uc.ctx); err != nil {
return fmt.Errorf("failed to start push chain client: %w", err)
if err := uc.pushWatcher.Start(uc.ctx); err != nil {
return fmt.Errorf("failed to start push watcher: %w", err)
}

if uc.tssNode != nil {
Expand Down Expand Up @@ -166,9 +168,9 @@ func (uc *UniversalClient) shutdown() {
}
}

if uc.pushChain != nil {
if err := uc.pushChain.Stop(); err != nil {
uc.log.Error().Err(err).Str("subsystem", "push_chain").Msg("subsystem failed to stop")
if uc.pushWatcher != nil {
if err := uc.pushWatcher.Stop(); err != nil {
uc.log.Error().Err(err).Str("subsystem", "push_watcher").Msg("subsystem failed to stop")
}
}

Expand Down
3 changes: 3 additions & 0 deletions universalClient/externalchains/chains_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ type mockChainClient struct {
func (m *mockChainClient) Start(ctx context.Context) error { m.startCalled = true; return nil }
func (m *mockChainClient) Stop() error { m.stopCalled = true; return m.stopErr }
func (m *mockChainClient) IsHealthy() bool { return true }
func (m *mockChainClient) GetReadRequestHandler() (common.ReadRequestHandler, error) {
return nil, nil
}
func (m *mockChainClient) GetTxBuilder() (common.TxBuilder, error) {
return nil, nil
}
Expand Down
18 changes: 0 additions & 18 deletions universalClient/externalchains/common/chain_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,24 +154,6 @@ func (cs *ChainStore) UpdateStatusAndEventData(eventID, oldStatus, newStatus str
return res.RowsAffected, nil
}

// UpdateVoteTxHash updates the vote_tx_hash field for an event
func (cs *ChainStore) UpdateVoteTxHash(eventID string, voteTxHash string) error {
if cs.database == nil {
return fmt.Errorf("database is nil")
}

result := cs.database.Client().
Model(&store.Event{}).
Where("event_id = ?", eventID).
Update("vote_tx_hash", voteTxHash)

if result.Error != nil {
return fmt.Errorf("failed to update vote_tx_hash: %w", result.Error)
}

return nil
}

// DeleteTerminalEvents deletes events in terminal states (COMPLETED, REVERTED, EXPIRED)
// that were updated before the given time
func (cs *ChainStore) DeleteTerminalEvents(updatedBefore any) (int64, error) {
Expand Down
23 changes: 0 additions & 23 deletions universalClient/externalchains/common/chain_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ func TestChainStoreNilDatabase(t *testing.T) {
assert.Contains(t, err.Error(), "database is nil")
})

t.Run("UpdateVoteTxHash returns error for nil database", func(t *testing.T) {
err := store.UpdateVoteTxHash("event-1", "0x123")
require.Error(t, err)
assert.Contains(t, err.Error(), "database is nil")
})

t.Run("InsertEventIfNotExists returns error for nil database", func(t *testing.T) {
inserted, err := store.InsertEventIfNotExists(nil)
require.Error(t, err)
Expand Down Expand Up @@ -222,23 +216,6 @@ func TestChainStore_UpdateStatusAndEventData(t *testing.T) {
assert.Equal(t, int64(1), rows)
}

func TestChainStore_UpdateVoteTxHash(t *testing.T) {
cs := newTestChainStore(t)

event := &storemodels.Event{
EventID: "evt-5",
BlockHeight: 50,
Type: storemodels.EventTypeOutbound,
ConfirmationType: storemodels.ConfirmationStandard,
Status: storemodels.StatusConfirmed,
}
_, err := cs.InsertEventIfNotExists(event)
require.NoError(t, err)

err = cs.UpdateVoteTxHash("evt-5", "0xvotehash")
require.NoError(t, err)
}

func TestChainStore_GetPendingEventsLimit(t *testing.T) {
cs := newTestChainStore(t)

Expand Down
Loading
Loading