Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
82e9f90
implement HTTP action capability without deduplication. pending unit …
jinhoonbang Jun 4, 2025
f2f533d
unit tests wip
jinhoonbang Jun 4, 2025
a462604
add unit tests for gateway outbound proxy test
jinhoonbang Jun 5, 2025
380bb9d
self-review
jinhoonbang Jun 5, 2025
b23c9e2
Update http/action/action.go
jinhoonbang Jun 5, 2025
eaa8b1e
Update http/gateway/gateway_outbound_proxy_test.go
jinhoonbang Jun 5, 2025
4e645cf
remove unnecessary sleep in test
jinhoonbang Jun 5, 2025
85aaee8
update according to interface changes in common
jinhoonbang Jun 9, 2025
e699865
add integration tests
jinhoonbang Jun 9, 2025
3602021
fix linting
jinhoonbang Jun 9, 2025
43ebbd2
use jsonrpc.Request instead of api.Message. address comments
jinhoonbang Jun 16, 2025
1efaadd
apply chainlink-common changes
jinhoonbang Jun 23, 2025
4a2fb3c
Merge remote-tracking branch 'origin/main' into PRODCRE-412-implement…
jinhoonbang Jun 25, 2025
bed9122
Merge remote-tracking branch 'origin/main' into PRODCRE-415-integrati…
jinhoonbang Jul 7, 2025
27fed0f
fixing build
jinhoonbang Jul 7, 2025
a5c4275
fix lint
jinhoonbang Jul 7, 2025
c11bbb3
update chainlink-common
jinhoonbang Jul 7, 2025
2f1a12e
Merge remote-tracking branch 'origin/main' into PRODCRE-415-integrati…
jinhoonbang Jul 7, 2025
2eb2553
build fix in progress
jinhoonbang Jul 7, 2025
4a87130
Merge branch 'main' into PRODCRE-415-integration-tests
jinhoonbang Jul 11, 2025
9e18849
fix tests and add test for POST
jinhoonbang Jul 11, 2025
3ad5392
undo go mod changes
jinhoonbang Jul 11, 2025
f1074c4
wip
jinhoonbang Jul 14, 2025
748199b
basic trigger test set up working
jinhoonbang Jul 15, 2025
c9a6c7f
basic tests working
jinhoonbang Jul 15, 2025
2127df5
Merge remote-tracking branch 'origin/main' into PRODCRE-421-integrati…
jinhoonbang Aug 18, 2025
e2b2c0e
update http trigger tests with workflow name/owner/tag and insufficie…
jinhoonbang Aug 19, 2025
906dcaf
add deduplication test
jinhoonbang Aug 19, 2025
7446b32
add go sum
jinhoonbang Aug 19, 2025
3884338
Update integration_tests/http/http_trigger_test.go
jinhoonbang Aug 19, 2025
61dbabc
Update integration_tests/http/http_trigger_test.go
jinhoonbang Aug 19, 2025
0baa303
add kvstore file
jinhoonbang Aug 19, 2025
d4ad808
lint
jinhoonbang Aug 19, 2025
ad00250
fix
jinhoonbang Aug 20, 2025
6799604
remove unnecessary code
jinhoonbang Aug 20, 2025
4d331cc
Merge remote-tracking branch 'origin/main' into PRODCRE-421-integrati…
jinhoonbang Aug 22, 2025
254c3cf
fix failing test
jinhoonbang Aug 22, 2025
1f3c417
fix timing issue
jinhoonbang Aug 22, 2025
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
6 changes: 3 additions & 3 deletions http_trigger/trigger/connector_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ func (h *connectorHandler) processTrigger(ctx context.Context, gatewayID string,
return // Error already sent in the method
}

err = h.triggerWorkflow(ctx, workflowID, req.ID, gatewayID, input, triggerReq.Key)
err = h.triggerWorkflow(ctx, workflowID, req.ID, gatewayID, workflowExecutionID, input, triggerReq.Key)
if err != nil {
l.Errorw("Failed to trigger workflow", "error", err)
return
Expand Down Expand Up @@ -417,15 +417,15 @@ func (h *connectorHandler) prepareAndCacheResponse(ctx context.Context, gatewayI
return resp, nil
}

func (h *connectorHandler) triggerWorkflow(ctx context.Context, workflowID string, reqID string, gatewayID string, input *structpb.Struct, key gateway_common.AuthorizedKey) error {
func (h *connectorHandler) triggerWorkflow(ctx context.Context, workflowID string, reqID string, gatewayID string, executionID string, input *structpb.Struct, key gateway_common.AuthorizedKey) error {
workflow, ok := h.workflowStore.getWorkflowByID(workflowID)
if !ok {
h.sendErrorResponse(ctx, gatewayID, reqID, jsonrpc.ErrInvalidRequest, "Workflow not registered")
return fmt.Errorf("workflowID %s not registered", workflowID)
}
err := workflow.trigger(ctx, capabilities.TriggerAndId[*http.Payload]{
// workflow engine does not process the request if the ID has already been used
Id: reqID,
Id: executionID,
Trigger: &http.Payload{
Input: input,
Key: &http.AuthorizedKey{
Expand Down
4 changes: 2 additions & 2 deletions http_trigger/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ func (s *service) Initialise(
workflowStore := newWorkflowStore(s.lggr)
metadataPublisher := NewGatewayMetadataPublisher(s.lggr, gc, outgoingRateLimiter, workflowStore, s.cfg)
requestCache := newRequestCache(s.lggr, kvstore, time.Duration(s.cfg.RequestCacheTTL)*time.Second)
s.connectorHandler, err = NewConnectorHandler(s.lggr, gc, s.cfg, outgoingRateLimiter, incomingRateLimiter, workflowStore, metadataPublisher, requestCache, s.metrics)
s.metrics, err = NewMetrics()
if err != nil {
return err
}
s.metrics, err = NewMetrics()
s.connectorHandler, err = NewConnectorHandler(s.lggr, gc, s.cfg, outgoingRateLimiter, incomingRateLimiter, workflowStore, metadataPublisher, requestCache, s.metrics)
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion integration_tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ replace github.com/smartcontractkit/capabilities/loadtestwritetarget => ../loadt

replace github.com/smartcontractkit/capabilities/http_action => ../http_action

replace github.com/smartcontractkit/capabilities/http_trigger => ../http_trigger

replace github.com/smartcontractkit/capabilities/chain_capabilities/evm => ../chain_capabilities/evm

replace github.com/fbsobreira/gotron-sdk => github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20250422175525-b7575d96bd4d
Expand All @@ -19,14 +21,15 @@ require (
github.com/pelletier/go-toml v1.9.5
github.com/smartcontractkit/capabilities/chain_capabilities/evm v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/capabilities/http_action v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/capabilities/http_trigger v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/capabilities/loadtestwritetarget v0.0.0-00010101000000-000000000000
github.com/smartcontractkit/chain-selectors v1.0.67
github.com/smartcontractkit/chainlink-common v0.9.1-0.20250814111752-91ec077f29f5
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250806152407-159881c7589c
github.com/smartcontractkit/chainlink-evm v0.3.1
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250808121824-2c3544aab8f3
github.com/smartcontractkit/chainlink-protos/workflows/go v0.0.0-20250722225531-876fd6b94976
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250815172930-d2c56f4161f3
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250816034529-0dfaccaa1b11
github.com/smartcontractkit/cre-sdk-go v0.3.0
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v0.3.0
github.com/smartcontractkit/cre-sdk-go/capabilities/scheduler/cron v0.2.1-0.20250729191525-ac1867f3ff34
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1132,8 +1132,8 @@ github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20250805160549-9c22
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20250805160549-9c2255ee818e/go.mod h1:ZnAaAWtczhBbsmb6GafTmAi6ncsj6dpZwHEaBePWQeQ=
github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20250422175525-b7575d96bd4d h1:qLmSOOtB/Ogn79eIDkuujOu8M5Jd747V1H7Brk/nTvo=
github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20250422175525-b7575d96bd4d/go.mod h1:4WhGgCA0smBbBud5mK+jnDb2wwndMvoqaWBJ3OV/7Bw=
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250815172930-d2c56f4161f3 h1:9E3NOob2Kbd8jjUSsEKbcHh1KjpUgH+hsyk+Yik4yhc=
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250815172930-d2c56f4161f3/go.mod h1:e0O1rxgaKFc0yDYp9xWmXFWA7wF0y+WkuRKvMTOTSiA=
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250816034529-0dfaccaa1b11 h1:FuK75DOBdMf8O71Ku11QW10IcmnVJQHAwCBtkGdpms8=
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250816034529-0dfaccaa1b11/go.mod h1:e0O1rxgaKFc0yDYp9xWmXFWA7wF0y+WkuRKvMTOTSiA=
github.com/smartcontractkit/cre-sdk-go v0.3.0 h1:7btZvnEsFkzlF09ZXO7rfGcQ+nFdrYp0LlahqntrTWw=
github.com/smartcontractkit/cre-sdk-go v0.3.0/go.mod h1:HqCmnnjRZ0B3uAMify4/Wahaz6kvwoZ6SvD1989M9QQ=
github.com/smartcontractkit/cre-sdk-go/capabilities/blockchain/evm v0.3.0 h1:+T4wQFRHdXAPGlN8ekBr/ZrO6xRx6thmVONAb9rnY6U=
Expand Down
49 changes: 29 additions & 20 deletions integration_tests/http/http_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package http_test
package http

import (
"context"
Expand All @@ -18,15 +18,15 @@ import (
"github.com/jonboulle/clockwork"
"github.com/stretchr/testify/require"

httpcap "github.com/smartcontractkit/capabilities/http_action/action"

"github.com/smartcontractkit/chainlink/v2/core/logger"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/config"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/connector"
"github.com/smartcontractkit/chainlink/v2/core/services/gateway/network"

httpcap "github.com/smartcontractkit/capabilities/http_action/action"

"github.com/smartcontractkit/chainlink-common/pkg/capabilities"
"github.com/smartcontractkit/chainlink-common/pkg/logger"
"github.com/smartcontractkit/chainlink-common/pkg/services/servicetest"
"github.com/smartcontractkit/chainlink-common/pkg/types/core"

Expand Down Expand Up @@ -80,22 +80,27 @@ const gatewayConfigTemplate = `
"Dons": [
{
"DonId": "test_don",
"HandlerName": "http-capabilities",
"HandlerConfig": {
"MaxAllowedMessageAgeSec": 1000,
"NodeRateLimiter": {
"GlobalBurst": 10,
"GlobalRPS": 50,
"PerSenderBurst": 10,
"PerSenderRPS": 10
},
"UserRateLimiter": {
"GlobalBurst": 10,
"GlobalRPS": 50,
"PerSenderBurst": 10,
"PerSenderRPS": 10
"F": 1,
"Handlers": [
{
"Name": "http-capabilities",
"ServiceName": "workflows",
"Config": {
"NodeRateLimiter": {
"GlobalBurst": 10,
"GlobalRPS": 50,
"PerSenderBurst": 10,
"PerSenderRPS": 10
},
"UserRateLimiter": {
"GlobalBurst": 10,
"GlobalRPS": 50,
"PerSenderBurst": 10,
"PerSenderRPS": 10
}
}
}
},
],
"Members": [
{
"Address": "%s",
Expand Down Expand Up @@ -156,6 +161,10 @@ func newTestNetworkClient(t *testing.T, addr *net.TCPAddr, lggr logger.Logger) n

func newTestGateway(t *testing.T, publicKey string, c network.HTTPClient, lggr logger.Logger) gateway.Gateway {
gatewayConfigStr := fmt.Sprintf(gatewayConfigTemplate, publicKey)
return newTestGatewayFromConfig(t, gatewayConfigStr, c, lggr)
}

func newTestGatewayFromConfig(t *testing.T, gatewayConfigStr string, c network.HTTPClient, lggr logger.Logger) gateway.Gateway {
var gatewayConfig *config.GatewayConfig
err := json.Unmarshal([]byte(gatewayConfigStr), &gatewayConfig)
require.NoError(t, err)
Expand Down Expand Up @@ -219,7 +228,7 @@ func (*client) Close() error {

func TestHTTPActionCapability(t *testing.T) {
ctx := t.Context()
lggr := logger.TestLogger(t)
lggr := logger.Test(t)

mux := http.NewServeMux()
mux.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
Expand Down
Loading
Loading