Skip to content

Commit 63055ab

Browse files
authored
Merge pull request #37 from smartcontractkit/yn-logs-5
Update core image
2 parents c5435f8 + 3916877 commit 63055ab

File tree

6 files changed

+50
-4
lines changed

6 files changed

+50
-4
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG BASE_IMAGE=local_chainlink
22

3-
FROM golang:1.24.2-bullseye as buildplugins
3+
FROM golang:1.24.5-bullseye as buildplugins
44
RUN go version
55

66
WORKDIR /build

relayer/cmd/chainlink-tron/default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ in
1818
];
1919

2020
# pin the vendor hash (update using 'pkgs.lib.fakeHash')
21-
vendorHash = "sha256-d7uPn6jiFjgpK7foLEXObdfFO6l2M3R5AU6anRKvqsw=";
21+
vendorHash = "sha256-SCl9rzV1LAN+0DTVDXCthin/VwR/rCNaz4WdxcpCPJY=";
2222

2323
# postInstall script to write version and rev to share folder
2424
postInstall = ''

relayer/plugin/relayer.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"errors"
66
"fmt"
77
"math/big"
8+
"os"
89
"strings"
910

1011
"github.com/fbsobreira/gotron-sdk/pkg/address"
@@ -77,6 +78,7 @@ func NewRelayer(cfg *config.TOMLConfig, lggr logger.Logger, keystore core.Keysto
7778
RetentionPeriod: cfg.RetentionPeriod(),
7879
ReapInterval: cfg.ReapInterval(),
7980
})
81+
lggr.Debugw("TronTxm instance created", "chainID", id, "instance_pointer", fmt.Sprintf("%p", txmgr), "relayer_pid", os.Getpid(), "core_pid", os.Getppid())
8082

8183
balanceMonitor := monitor.NewBalanceMonitor(id, cfg, lggr, keystore, func() (monitor.BalanceClient, error) {
8284
return client.SolidityClient(), nil

relayer/utils.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,16 @@ func PublicKeyToTronAddress(pubKey string) (address.Address, error) {
3030
return nil, fmt.Errorf("public key cannot be empty")
3131
}
3232

33+
// Try Base58 first
34+
addr, err := address.StringToAddress(pubKey)
35+
if err == nil {
36+
return addr, nil
37+
}
38+
39+
// Otherwise, treat as pubkey
3340
pubKeyBytes, err := hex.DecodeString(pubKey)
3441
if err != nil {
35-
return nil, err
42+
return nil, fmt.Errorf("invalid pubkey: %w", err)
3643
}
3744
hash := sha3.NewLegacyKeccak256()
3845
hash.Write(pubKeyBytes[1:]) // remove the 0x04 format identifier prefix

relayer/utils_test.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package relayer_test
33
import (
44
"testing"
55

6+
"github.com/fbsobreira/gotron-sdk/pkg/address"
67
"github.com/fbsobreira/gotron-sdk/pkg/http/common"
78
"github.com/stretchr/testify/require"
89

@@ -95,3 +96,39 @@ func TestByteArrToStr(t *testing.T) {
9596
str := relayer.ByteArrayToStr(b)
9697
require.Equal(t, "[0x010203,0x040506]", str)
9798
}
99+
100+
func TestPublicKeyToTronAddress(t *testing.T) {
101+
tests := []struct {
102+
name string
103+
input string
104+
expectErr bool
105+
verifyFunc func(addr address.Address) bool
106+
}{
107+
{
108+
name: "valid tron base58 address",
109+
input: "TRvVjWF1XHh2Tw5rVcRvrc9ZwDtWGqBp9v", // any valid address
110+
expectErr: false,
111+
verifyFunc: func(addr address.Address) bool {
112+
return addr.String() == "TRvVjWF1XHh2Tw5rVcRvrc9ZwDtWGqBp9v"
113+
},
114+
},
115+
}
116+
117+
for _, tt := range tests {
118+
t.Run(tt.name, func(t *testing.T) {
119+
addr, err := relayer.PublicKeyToTronAddress(tt.input)
120+
121+
if tt.expectErr {
122+
require.Error(t, err)
123+
return
124+
}
125+
126+
require.NoError(t, err)
127+
require.NotNil(t, addr)
128+
129+
if tt.verifyFunc != nil {
130+
require.True(t, tt.verifyFunc(addr), "unexpected address result: %s", addr.String())
131+
}
132+
})
133+
}
134+
}

scripts/build/Dockerfile.build.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# syntax = docker/dockerfile:1.4
33

44
# Takes Chainlink core as a base image and layers in plugins
5-
ARG BASE_IMAGE=public.ecr.aws/chainlink/chainlink:2.26.0
5+
ARG BASE_IMAGE=public.ecr.aws/chainlink/chainlink:2.28.0
66
# Build the 'default' pkg if not set
77
ARG NIX_BUILD_PKG=default
88

0 commit comments

Comments
 (0)