Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/rs/zerolog v1.33.0
github.com/smartcontractkit/chainlink-common v0.8.1-0.20250730004800-27955557aca6
github.com/smartcontractkit/chainlink-testing-framework/lib v1.54.1
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20250701132001-f8be142155b6
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20250804130351-2a3614fc03cc
github.com/smartcontractkit/chainlink/deployment v0.0.0-20250428183335-14ac746cbe81
github.com/smartcontractkit/chainlink/v2 v2.23.2-por-beta.1.0.20250729150432-5ea4a324a49b
github.com/smartcontractkit/libocr v0.0.0-20250707144819-babe0ec4e358
Expand Down Expand Up @@ -251,10 +251,10 @@ require (
github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.1 // indirect
github.com/smartcontractkit/chainlink-common/pkg/values v0.0.0-20250718143957-41236f9ef8b4 // indirect
github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-20250718160737-52367713623f // indirect
github.com/smartcontractkit/chainlink-evm v0.0.0-20250717140849-58bcb2816c08 // indirect
github.com/smartcontractkit/chainlink-evm v0.1.1-0.20250804133850-d8e2f43db387 // indirect
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250717121125-2350c82883e2 // indirect
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250618135814-7e3f79ab707e // indirect
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250522110034-65c54665034a // indirect
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250717121125-2350c82883e2 // indirect
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250729142306-508e798f6a5d // indirect
github.com/smartcontractkit/chainlink-protos/svr v1.1.0 // indirect
github.com/smartcontractkit/freeport v0.1.1 // indirect
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -929,18 +929,18 @@ github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-2025
github.com/smartcontractkit/chainlink-common/pkg/workflows/sdk/v2/pb v0.0.0-20250718160737-52367713623f/go.mod h1:LEZQ/SbFHseQJrLKVm6ELB8gyI4G8rVEH3SQzzZqFDk=
github.com/smartcontractkit/chainlink-data-streams v0.1.2 h1:g/UmFJa/E1Zmc7NO20ob5SijxQen51DhnqTLr2f7BEc=
github.com/smartcontractkit/chainlink-data-streams v0.1.2/go.mod h1:lxY97sDlDorQAmLGFo6x1tl8SQ2E7adsS0/wU8+mmTc=
github.com/smartcontractkit/chainlink-evm v0.0.0-20250717140849-58bcb2816c08 h1:CppYDovAiyJz+D14jtaci8wuHnumHTB2lQ68LamGbdg=
github.com/smartcontractkit/chainlink-evm v0.0.0-20250717140849-58bcb2816c08/go.mod h1:c+0Vwbh3whz8SUxRvsYiOkbuQUlK1ckyQ49HTNUjJcI=
github.com/smartcontractkit/chainlink-evm v0.1.1-0.20250804133850-d8e2f43db387 h1:tGOOqInwufJzE1Orbs5rTEPYv7KEiCDIMIrtuEi4QDo=
github.com/smartcontractkit/chainlink-evm v0.1.1-0.20250804133850-d8e2f43db387/go.mod h1:DAcHXKZjbLVrqAMCWUXWfULLLdu0KSF2R4LvdvY92q8=
github.com/smartcontractkit/chainlink-feeds v0.1.2-0.20250227211209-7cd000095135 h1:8u9xUrC+yHrTDexOKDd+jrA6LCzFFHeX1G82oj2fsSI=
github.com/smartcontractkit/chainlink-feeds v0.1.2-0.20250227211209-7cd000095135/go.mod h1:NkvE4iQgiT7dMCP6U3xPELHhWhN5Xr6rHC0axRebyMU=
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250702183345-3f9ae622e391 h1:4dUBtClcoG6QHY2JYqkpZ3GLL6DUX6pVP52wb7qVY48=
github.com/smartcontractkit/chainlink-framework/capabilities v0.0.0-20250702183345-3f9ae622e391/go.mod h1:GSz65mYV8hzb8LCRhbhoVn4i3el87nrXTBQE8KF1Qao=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250717121125-2350c82883e2 h1:JU1JUrkzdAUHsOYdS9DENPkJfmrxweFRPRSztad6oPM=
github.com/smartcontractkit/chainlink-framework/chains v0.0.0-20250717121125-2350c82883e2/go.mod h1:+pRGfDej1r7cHMs1dYmuyPuOZzYB9Q+PKu0FvZOYlmw=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250618135814-7e3f79ab707e h1:LRT+PltY99+hxZAJn+4nyTfqGVNEM1S6FJ675B9BtJo=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250618135814-7e3f79ab707e/go.mod h1:jo+cUqNcHwN8IF7SInQNXDZ8qzBsyMpnLdYbDswviFc=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250522110034-65c54665034a h1:O28vgyHM7QF1YLg1BwkQSIbOYA+t0RiH9+b+k90GPG8=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250522110034-65c54665034a/go.mod h1:zYqPBBRUXUQ/L+aD4Q7phnYsfVeC5rDBXtPt1VYwtws=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250717121125-2350c82883e2 h1:ysZjKH+BpWlQhF93kr/Lc668UlCvT9NjfcsGdZT19I8=
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250717121125-2350c82883e2/go.mod h1:jo+cUqNcHwN8IF7SInQNXDZ8qzBsyMpnLdYbDswviFc=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250729142306-508e798f6a5d h1:pTYIcsWHTMG5fAcbRUA8Qk5yscXKdSpopQ0DUEOjPik=
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250729142306-508e798f6a5d/go.mod h1:2JTBNp3FlRdO/nHc4dsc9bfxxMClMO1Qt8sLJgtreBY=
github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20250722175102-6dcdf5122683 h1:Qjiw8yaKi42jjknW1+ox6+QHc4aJVm0uhVoKTlmZryU=
github.com/smartcontractkit/chainlink-protos/billing/go v0.0.0-20250722175102-6dcdf5122683/go.mod h1:HHGeDUpAsPa0pmOx7wrByCitjQ0mbUxf0R9v+g67uCA=
github.com/smartcontractkit/chainlink-protos/orchestrator v0.8.1 h1:VcFo27MBPTMB1d1Tp3q3RzJNqwErKR+z9QLQZ6KBSXo=
Expand Down
8 changes: 5 additions & 3 deletions integration-tests/ocr2_local_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,11 @@ func runOCR2Test(
require.NoError(t, err, "Could not create relay logger")

testKeystore := testutils.NewTestKeystore(pubAddress.String(), privateKey)
txmgr := txm.New(clientLogger, testKeystore, combinedClient.FullNodeClient(), txm.TronTxmConfig{
txmgr := txm.New(clientLogger, testKeystore, combinedClient, txm.TronTxmConfig{
BroadcastChanSize: 100,
ConfirmPollSecs: 2,
RetentionPeriod: 8 * time.Minute,
ReapInterval: 10 * time.Second,
})
err = txmgr.Start(context.Background())
require.NoError(t, err)
Expand Down Expand Up @@ -149,10 +151,10 @@ func runOCR2Test(
deployContract := func(contractName string, artifact *contract.Artifact, params []interface{}) address.Address {
txHash := testutils.SignAndDeployContract(t, combinedClient, testKeystore, pubAddress, contractName, artifact.AbiJson, artifact.Bytecode, feeLimit, params)
// use full node client for quicker feedback
txInfo := testutils.WaitForTransactionInfo(t, combinedClient.FullNodeClient(), txHash, txnWaitTime)
txInfo := testutils.WaitForTransactionInfo(t, combinedClient, txHash, txnWaitTime)
contractAddress, err := address.StringToAddress(txInfo.ContractAddress)
require.NoError(t, err)
contractDeployed := testutils.CheckContractDeployed(t, combinedClient.FullNodeClient(), contractAddress)
contractDeployed := testutils.CheckContractDeployed(t, combinedClient, contractAddress)
require.True(t, contractDeployed, "Contract not deployed")
return contractAddress
}
Expand Down
2 changes: 1 addition & 1 deletion relayer/cmd/chainlink-tron/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ in
];

# pin the vendor hash (update using 'pkgs.lib.fakeHash')
vendorHash = "sha256-2esJryFB5ghbOY/LWkTtHA9vd2M9I1MEwImp1ttTt5M=";
vendorHash = "sha256-pYy4CwYI9ID5+9+5coZqQyMbdu7LMD/ufvCHzqPfjao=";

# postInstall script to write version and rev to share folder
postInstall = ''
Expand Down
5 changes: 3 additions & 2 deletions relayer/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ require (
github.com/go-viper/mapstructure/v2 v2.3.0 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v1.0.0 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1 // indirect
Expand Down Expand Up @@ -110,8 +111,8 @@ require (
github.com/stretchr/objx v0.5.2 // indirect
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/tklauser/go-sysconf v0.3.15 // indirect
github.com/tklauser/numcpus v0.10.0 // indirect
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
Expand Down
12 changes: 6 additions & 6 deletions relayer/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk=
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
Expand Down Expand Up @@ -442,10 +442,10 @@ github.com/supranational/blst v0.3.14 h1:xNMoHRJOTwMn63ip6qoWJ2Ymgvj7E2b9jY2FAwY
github.com/supranational/blst v0.3.14/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4=
github.com/tklauser/go-sysconf v0.3.13/go.mod h1:zwleP4Q4OehZHGn4CYZDipCgg9usW5IJePewFCGVEa0=
github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4=
github.com/tklauser/numcpus v0.7.0/go.mod h1:bb6dMVcj8A42tSE7i32fsIUCbQNllK5iDguyOZRUzAY=
github.com/tklauser/go-sysconf v0.3.15 h1:VE89k0criAymJ/Os65CSn1IXaol+1wrsFHEB8Ol49K4=
github.com/tklauser/go-sysconf v0.3.15/go.mod h1:Dmjwr6tYFIseJw7a3dRLJfsHAMXZ3nEnL/aZY+0IuI4=
github.com/tklauser/numcpus v0.10.0 h1:18njr6LDBk1zuna922MgdjQuJFjrdppsZG60sHGfjso=
github.com/tklauser/numcpus v0.10.0/go.mod h1:BiTKazU708GQTYF4mB+cmlpT2Is1gLk7XVuEeem8LsQ=
github.com/urfave/cli/v2 v2.27.5 h1:WoHEJLdsXr6dDWoJgMq/CboDmyY/8HMMH1fTECbih+w=
github.com/urfave/cli/v2 v2.27.5/go.mod h1:3Sevf16NykTbInEnD0yKkjDAeZDS0A6bzhBH5hrMvTQ=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
Expand Down
14 changes: 14 additions & 0 deletions relayer/plugin/chain_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ var defaultConfigSet = chainConfigSet{
OCR2CachePollPeriod: 5 * time.Second,
// time to live for OCR2 contract cache
OCR2CacheTTL: time.Minute,
// retention period for transaction manager
RetentionPeriod: 0,
// reap interval for transaction manager
ReapInterval: 1 * time.Minute,
}

// opt: remove
Expand All @@ -28,6 +32,8 @@ type chainConfigSet struct {
OCR2CachePollPeriod time.Duration
OCR2CacheTTL time.Duration
BalancePollPeriod time.Duration
RetentionPeriod time.Duration
ReapInterval time.Duration
}

type ChainConfig struct {
Expand All @@ -36,6 +42,8 @@ type ChainConfig struct {
OCR2CachePollPeriod *time.Duration
OCR2CacheTTL *time.Duration
BalancePollPeriod *time.Duration
RetentionPeriod *time.Duration
ReapInterval *time.Duration
}

func (c *ChainConfig) SetDefaults() {
Expand All @@ -54,6 +62,12 @@ func (c *ChainConfig) SetDefaults() {
if c.BalancePollPeriod == nil {
c.BalancePollPeriod = &defaultConfigSet.BalancePollPeriod
}
if c.RetentionPeriod == nil {
c.RetentionPeriod = &defaultConfigSet.RetentionPeriod
}
if c.ReapInterval == nil {
c.ReapInterval = &defaultConfigSet.ReapInterval
}
}

type NodeConfig struct {
Expand Down
2 changes: 2 additions & 0 deletions relayer/plugin/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func NewRelayer(cfg *TOMLConfig, lggr logger.Logger, keystore core.Keystore) (*T
BroadcastChanSize: uint(cfg.BroadcastChanSize()),
ConfirmPollSecs: uint(cfg.ConfirmPollPeriod().Seconds()),
EnergyMultiplier: 1.5, // TODO: This was the exisiting value for DF, longer term this should be a config option
RetentionPeriod: cfg.RetentionPeriod(),
ReapInterval: cfg.ReapInterval(),
})

balanceMonitor := monitor.NewBalanceMonitor(id, cfg, lggr, keystore, func() (monitor.BalanceClient, error) {
Expand Down
18 changes: 18 additions & 0 deletions relayer/plugin/toml_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ func setFromChain(c, f *ChainConfig) {
if f.OCR2CacheTTL != nil {
c.OCR2CacheTTL = f.OCR2CacheTTL
}
if f.RetentionPeriod != nil {
c.RetentionPeriod = f.RetentionPeriod
}
if f.ReapInterval != nil {
c.ReapInterval = f.ReapInterval
}
}

func (c *TOMLConfig) ValidateConfig() error {
Expand Down Expand Up @@ -204,6 +210,18 @@ func (c *TOMLConfig) OCR2CacheTTL() time.Duration {
return *c.ChainConfig.OCR2CacheTTL
}

func (c *TOMLConfig) RetentionPeriod() time.Duration {
return *c.ChainConfig.RetentionPeriod
}

func (c *TOMLConfig) ReapInterval() time.Duration {
return *c.ChainConfig.ReapInterval
}

func (c *TOMLConfig) SetDefaults() {
c.ChainConfig.SetDefaults()
}

func NewDefault() *TOMLConfig {
cfg := &TOMLConfig{}
cfg.SetDefaults()
Expand Down
17 changes: 9 additions & 8 deletions relayer/testutils/txm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func WaitForInflightTxs(logger logger.Logger, txmgr *txm.TronTxm, timeout time.D
queueLen, unconfirmedLen := txmgr.InflightCount()
logger.Debugw("Inflight count", "queued", queueLen, "unconfirmed", unconfirmedLen)
if queueLen == 0 && unconfirmedLen == 0 {
logger.Debugw("No inflight txs, exiting")
break
}
if time.Since(start) > timeout {
Expand All @@ -34,9 +35,9 @@ func WaitForInflightTxs(logger logger.Logger, txmgr *txm.TronTxm, timeout time.D
}
}

func SignAndDeployContract(t *testing.T, fullnodeClient sdk.FullNodeClient, keystore loop.Keystore, fromAddress address.Address, contractName string, abiJson string, codeHex string, feeLimit int, params []interface{}) string {
deployResponse, err := fullnodeClient.DeployContract(
fromAddress, contractName, abiJson, codeHex, 0, 100, feeLimit, params)
func SignAndDeployContract(t *testing.T, combinedClient sdk.CombinedClient, keystore loop.Keystore, fromAddress address.Address, contractName string, abiJson string, codeHex string, feeLimit int, params []interface{}) string {
deployResponse, err := combinedClient.DeployContract(
fromAddress, contractName, abiJson, codeHex, 1, 100, feeLimit, params)
require.NoError(t, err)

tx := &deployResponse.Transaction
Expand All @@ -47,22 +48,22 @@ func SignAndDeployContract(t *testing.T, fullnodeClient sdk.FullNodeClient, keys
require.NoError(t, err)
tx.AddSignatureBytes(signature)

broadcastResponse, err := fullnodeClient.BroadcastTransaction(tx)
broadcastResponse, err := combinedClient.BroadcastTransaction(tx)
require.NoError(t, err)

return broadcastResponse.TxID
}

func CheckContractDeployed(t *testing.T, fullnodeClient sdk.FullNodeClient, address address.Address) (contractDeployed bool) {
_, err := fullnodeClient.GetContract(address)
func CheckContractDeployed(t *testing.T, combinedClient sdk.CombinedClient, address address.Address) (contractDeployed bool) {
_, err := combinedClient.GetContract(address)
require.NoError(t, err)

return true // require call above stops execution if false
}

func WaitForTransactionInfo(t *testing.T, client sdk.FullNodeClient, txHash string, waitSecs int) *soliditynode.TransactionInfo {
func WaitForTransactionInfo(t *testing.T, client sdk.CombinedClient, txHash string, waitSecs int) *soliditynode.TransactionInfo {
for i := 1; i <= waitSecs; i++ {
txInfo, err := client.GetTransactionInfoById(txHash)
txInfo, err := client.GetTransactionInfoByIdFullNode(txHash)
if err != nil {
time.Sleep(time.Second)
continue
Expand Down
4 changes: 4 additions & 0 deletions relayer/txm/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package txm

import "time"

type TronTxmConfig struct {
BroadcastChanSize uint
ConfirmPollSecs uint
EnergyMultiplier float64
FixedEnergyValue int64
RetentionPeriod time.Duration
ReapInterval time.Duration
}
5 changes: 5 additions & 0 deletions relayer/txm/tx.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package txm

import (
"time"

"github.com/fbsobreira/gotron-sdk/pkg/address"
)

Expand All @@ -12,4 +14,7 @@ type TronTx struct {
Attempt uint64
OutOfTimeErrors uint64
EnergyBumpTimes uint32
ID string // idempotency key
State TxState
CreateTs time.Time
}
Loading
Loading