Skip to content

Commit dc74783

Browse files
committed
Merge branch 'develop' into fix/inject-df-decoder
2 parents 5033db9 + f1e8aec commit dc74783

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

pkg/chains/legacyevm/chain.go

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/smartcontractkit/chainlink-evm/pkg/logpoller"
3232
"github.com/smartcontractkit/chainlink-evm/pkg/monitor"
3333
"github.com/smartcontractkit/chainlink-evm/pkg/txmgr"
34+
evmtypes "github.com/smartcontractkit/chainlink-evm/pkg/types"
3435
ubig "github.com/smartcontractkit/chainlink-evm/pkg/utils/big"
3536
trontxm "github.com/smartcontractkit/chainlink-tron/relayer/txm"
3637
)
@@ -64,33 +65,43 @@ var (
6465

6566
// LegacyChains implements [LegacyChainContainer]
6667
type LegacyChains struct {
67-
*chains.ChainsKV[types.ChainService]
68+
*chains.ChainsKV[Chain]
69+
70+
cfgs toml.EVMConfigs
6871
}
6972

70-
// LegacyChainContainer is container for EVM chains of type [types.ChainService], which may be castable to [Chain].
71-
// The cast will fail if the chain is running in LOOPP mode, in which case the legacy API is limited to the overlapping set
72-
// defined by [types.ChainService].
73+
// LegacyChainContainer is container for EVM chains.
7374
type LegacyChainContainer interface {
74-
Get(id string) (types.ChainService, error)
75+
Get(id string) (Chain, error)
7576
Len() int
76-
List(ids ...string) ([]types.ChainService, error)
77-
Slice() []types.ChainService
77+
List(ids ...string) ([]Chain, error)
78+
Slice() []Chain
79+
80+
// BCF-2516: this is only used for EVMORM. When we delete that
81+
// we can promote/move the needed funcs from it to LegacyChainContainer
82+
// so instead of EVMORM().XYZ() we'd have something like legacyChains.XYZ()
83+
ChainNodeConfigs() evmtypes.Configs
7884
}
7985

8086
var _ LegacyChainContainer = &LegacyChains{}
8187

82-
func NewLegacyChains(m map[string]types.ChainService) *LegacyChains {
88+
func NewLegacyChains(m map[string]Chain, evmCfgs toml.EVMConfigs) *LegacyChains {
8389
return &LegacyChains{
84-
ChainsKV: chains.NewChainsKV[types.ChainService](m),
90+
ChainsKV: chains.NewChainsKV[Chain](m),
91+
cfgs: evmCfgs,
8592
}
8693
}
8794

95+
func (c *LegacyChains) ChainNodeConfigs() evmtypes.Configs {
96+
return c.cfgs
97+
}
98+
8899
// backward compatibility.
89100
// eth keys are represented as multiple types in the code base;
90101
// *big.Int, string, and int64.
91102
//
92103
// TODO BCF-2507 unify the type system
93-
func (c *LegacyChains) Get(id string) (types.ChainService, error) {
104+
func (c *LegacyChains) Get(id string) (Chain, error) {
94105
if id == nilBigInt.String() || id == emptyString {
95106
return nil, fmt.Errorf("invalid chain id requested: %q", id)
96107
}

pkg/chains/legacyevm/chain_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"github.com/stretchr/testify/assert"
88

99
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil/sqltest"
10-
"github.com/smartcontractkit/chainlink-common/pkg/types"
1110
"github.com/smartcontractkit/chainlink-common/pkg/utils/mailbox"
1211
"github.com/smartcontractkit/chainlink-evm/pkg/chains/legacyevm"
1312
"github.com/smartcontractkit/chainlink-evm/pkg/chains/legacyevm/mocks"
@@ -18,9 +17,10 @@ import (
1817
func TestLegacyChains(t *testing.T) {
1918
c := mocks.NewChain(t)
2019
c.On("ID").Return(big.NewInt(7))
21-
m := map[string]types.ChainService{c.ID().String(): c}
20+
m := map[string]legacyevm.Chain{c.ID().String(): c}
2221

23-
l := legacyevm.NewLegacyChains(m)
22+
l := legacyevm.NewLegacyChains(m, []*toml.EVMConfig{})
23+
assert.NotNil(t, l.ChainNodeConfigs())
2424
got, err := l.Get(c.ID().String())
2525
assert.NoError(t, err)
2626
assert.Equal(t, c, got)

pkg/logpoller/log_poller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,7 @@ func (lp *logPoller) PruneOldBlocks(ctx context.Context) (bool, error) {
12201220
// Remove <= 2
12211221
rowsRemoved, err := lp.orm.DeleteBlocksBefore(
12221222
ctx,
1223-
latestBlock.FinalizedBlockNumber-lp.keepFinalizedBlocksDepth,
1223+
referenceBlockNumber-lp.keepFinalizedBlocksDepth,
12241224
lp.logPrunePageSize,
12251225
)
12261226
return lp.logPrunePageSize == 0 || rowsRemoved < lp.logPrunePageSize, err

0 commit comments

Comments
 (0)