From 2f2e1594ec07082dbb8a1cf1c4b1332984857db4 Mon Sep 17 00:00:00 2001 From: Matee Ullah Malik Date: Wed, 19 Nov 2025 13:29:05 +0000 Subject: [PATCH 1/2] Add Action Lock --- pkg/lumera/modules/action_msg/impl.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/lumera/modules/action_msg/impl.go b/pkg/lumera/modules/action_msg/impl.go index b2329e21..e60b06ba 100644 --- a/pkg/lumera/modules/action_msg/impl.go +++ b/pkg/lumera/modules/action_msg/impl.go @@ -3,6 +3,7 @@ package action_msg import ( "context" "fmt" + "sync" actiontypes "github.com/LumeraProtocol/lumera/x/action/v1/types" "github.com/LumeraProtocol/supernode/v2/pkg/lumera/modules/auth" @@ -16,6 +17,7 @@ import ( type module struct { client actiontypes.MsgClient txHelper *txmod.TxHelper + mu sync.Mutex } func newModule(conn *grpc.ClientConn, authmodule auth.Module, txmodule txmod.Module, kr keyring.Keyring, keyName string, chainID string) (Module, error) { @@ -49,6 +51,9 @@ func (m *module) RequestAction(ctx context.Context, actionType, metadata, price, return nil, err } + m.mu.Lock() + defer m.mu.Unlock() + return m.txHelper.ExecuteTransaction(ctx, func(creator string) (types.Msg, error) { return createRequestActionMessage(creator, actionType, metadata, price, expirationTime), nil }) @@ -59,6 +64,9 @@ func (m *module) FinalizeCascadeAction(ctx context.Context, actionId string, rqI return nil, err } + m.mu.Lock() + defer m.mu.Unlock() + return m.txHelper.ExecuteTransaction(ctx, func(creator string) (types.Msg, error) { return createFinalizeActionMessage(creator, actionId, rqIdsIds) }) From 81df2349b4e0397194e00e23983575f4141ce3ea Mon Sep 17 00:00:00 2001 From: Matee ullah Date: Sun, 23 Nov 2025 05:30:28 +0500 Subject: [PATCH 2/2] update --- pkg/lumera/modules/action_msg/impl.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkg/lumera/modules/action_msg/impl.go b/pkg/lumera/modules/action_msg/impl.go index e60b06ba..804fcb88 100644 --- a/pkg/lumera/modules/action_msg/impl.go +++ b/pkg/lumera/modules/action_msg/impl.go @@ -76,11 +76,11 @@ func (m *module) SetTxHelperConfig(config *txmod.TxHelperConfig) { if config == nil { return } - m.txHelper.UpdateConfig(config) -} -func (m *module) GetTxHelper() *txmod.TxHelper { - return m.txHelper + m.mu.Lock() + defer m.mu.Unlock() + + m.txHelper.UpdateConfig(config) } // SimulateFinalizeCascadeAction builds the finalize message and performs a simulation @@ -91,6 +91,9 @@ func (m *module) SimulateFinalizeCascadeAction(ctx context.Context, actionId str return nil, err } + m.mu.Lock() + defer m.mu.Unlock() + // Gather account info and creator address accountInfo, err := m.txHelper.GetAccountInfo(ctx) if err != nil {