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
5 changes: 5 additions & 0 deletions .changeset/ready-turkeys-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

#changed change FixtureChainID
2 changes: 1 addition & 1 deletion core/cmd/direct-request-spec-template.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type = "directrequest"
schemaVersion = 1
evmChainID = "0"
evmChainID = "%s"
name = "%s"
contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C"
externalJobID = "%s"
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/eth_keys_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func TestShell_ListETHKeys_Disabled(t *testing.T) {
assert.Nil(t, balances[0].LinkBalance)
assert.Nil(t, balances[0].MaxGasPriceWei)
assert.Equal(t, []string{
k.Address.String(), "0", "Unknown", "Unknown", "false",
k.Address.String(), testutils.FixtureChainID.String(), "Unknown", "Unknown", "false",
balances[0].UpdatedAt.String(), balances[0].CreatedAt.String(), "None",
}, balances[0].ToRow())
}
Expand Down Expand Up @@ -189,7 +189,7 @@ func TestShell_CreateETHKey(t *testing.T) {
require.NoError(t, err)
require.Len(t, keys, 1)

id := big.NewInt(0)
id := testutils.FixtureChainID

set := flag.NewFlagSet("test", 0)
flagSetApplyFromAction(client.CreateETHKey, set, "")
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/jobs_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ func TestJob_ToRows(t *testing.T) {
var directRequestSpecTemplate string

func getDirectRequestSpec() string {
return fmt.Sprintf(directRequestSpecTemplate, uuid.New(), uuid.New())
return fmt.Sprintf(directRequestSpecTemplate, testutils.FixtureChainID.String(), uuid.New(), uuid.New())
}

func TestShell_ListFindJobs(t *testing.T) {
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestShell_CreateJobV2(t *testing.T) {
flagSetApplyFromAction(client.CreateJob, fs, "")

nameAndExternalJobID := uuid.New()
spec := fmt.Sprintf(ocrBootstrapSpec, nameAndExternalJobID, nameAndExternalJobID)
spec := fmt.Sprintf(ocrBootstrapSpec, nameAndExternalJobID, nameAndExternalJobID, testutils.FixtureChainID.String())
require.NoError(t, fs.Parse([]string{spec}))

err := client.CreateJob(cli.NewContext(nil, fs, nil))
Expand Down
2 changes: 1 addition & 1 deletion core/cmd/ocr-bootstrap-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ schemaVersion = 1
contractAddress = "0x27548a32b9aD5D64c5945EaE9Da5337bc3169D15"
externalJobID = "%s"
name = "%s"
evmChainID = "0"
evmChainID = "%s"
p2pv2Bootstrappers = ["12D3KooWHfYFQ8hGttAYbMCevQVESEQhzJAqFZokMVtom8bNxwGq@127.0.0.1:5001"]
isBootstrapPeer = true
2 changes: 1 addition & 1 deletion core/cmd/shell_remote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func TestShell_ReplayBlocks(t *testing.T) {
c := cli.NewContext(nil, set, nil)
assert.ErrorContains(t, client.ReplayFromBlock(c), "chain id does not match any local chains")

require.NoError(t, set.Set("chain-id", "0"))
require.NoError(t, set.Set("chain-id", testutils.FixtureChainID.String()))
c = cli.NewContext(nil, set, nil)
assert.NoError(t, client.ReplayFromBlock(c))

Expand Down
4 changes: 2 additions & 2 deletions core/internal/cltest/job_factories.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (
type = "offchainreporting"
schemaVersion = 1
contractAddress = "%s"
evmChainID = "0"
evmChainID = "%s"
p2pPeerID = "%s"
p2pv2Bootstrappers = ["12D3KooWHfYFQ8hGttAYbMCevQVESEQhzJAqFZokMVtom8bNxwGq@127.0.0.1:5001"]
isBootstrapPeer = false
Expand All @@ -39,7 +39,7 @@ const (
)

func MinimalOCRNonBootstrapSpec(contractAddress, transmitterAddress types.EIP55Address, peerID p2pkey.PeerID, keyBundleID string) string {
return fmt.Sprintf(minimalOCRNonBootstrapTemplate, contractAddress, peerID, transmitterAddress.Hex(), keyBundleID)
return fmt.Sprintf(minimalOCRNonBootstrapTemplate, contractAddress, testutils.FixtureChainID.String(), peerID, transmitterAddress.Hex(), keyBundleID)
}

func MustInsertWebhookSpec(t *testing.T, ds sqlutil.DataSource) (job.Job, job.WebhookSpec) {
Expand Down
9 changes: 8 additions & 1 deletion core/internal/testutils/evmtest/evmtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,19 @@ func NewChainOpts(t testing.TB, testopts TestChainOpts) (logger.Logger, keystore
return lggr, testopts.KeyStore, opts
}

const NullClientChainID = evmclient.NullClientChainID

// Deprecated, this is a replacement function for tests for now removed default evmChainID logic
func MustGetDefaultChainID(t testing.TB, evmCfgs configtoml.EVMConfigs) *big.Int {
if len(evmCfgs) == 0 {
t.Fatalf("at least one evm chain config must be defined")
}
return evmCfgs[0].ChainID.ToInt()
chainID := evmCfgs[0].ChainID.ToInt()
if chainID.Uint64() == 0 {
chainID = big.NewInt(NullClientChainID)
t.Logf("Overriding zero chain ID with %d. Update this test to use a valid chain ID.", NullClientChainID)
}
return chainID
}

// Deprecated, this is a replacement function for tests for now removed default chain logic
Expand Down
6 changes: 2 additions & 4 deletions core/internal/testutils/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,15 @@ import (
// anything from "github.com/smartcontractkit/chainlink/v2/core"
"github.com/smartcontractkit/chainlink-common/pkg/sqlutil"
"github.com/smartcontractkit/chainlink-common/pkg/utils/tests"
evmtestutils "github.com/smartcontractkit/chainlink-evm/pkg/testutils"
)

const (
// Password just a password we use everywhere for testing
Password = "16charlengthp4SsW0rD1!@#_"
)

// FixtureChainID matches the chain always added by fixtures.sql
// It is set to 0 since no real chain ever has this ID and allows a virtual
// "test" chain ID to be used without clashes
var FixtureChainID = big.NewInt(0)
var FixtureChainID = evmtestutils.FixtureChainID

// SimulatedChainID is the chain ID for the go-ethereum simulated backend
var SimulatedChainID = big.NewInt(1337)
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ require (
github.com/smartcontractkit/chainlink-common v0.9.4
github.com/smartcontractkit/chainlink-data-streams v0.1.2
github.com/smartcontractkit/chainlink-deployments-framework v0.25.0
github.com/smartcontractkit/chainlink-evm v0.3.2
github.com/smartcontractkit/chainlink-evm v0.3.3-0.20250903140346-aacd485a7dea
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250827130336-5922343458be
github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20250819150450-95ef563f6e6d
github.com/smartcontractkit/chainlink-testing-framework/framework v0.10.12
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1540,8 +1540,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.1.2 h1:g/UmFJa/E1Zmc7NO20o
github.com/smartcontractkit/chainlink-data-streams v0.1.2/go.mod h1:lxY97sDlDorQAmLGFo6x1tl8SQ2E7adsS0/wU8+mmTc=
github.com/smartcontractkit/chainlink-deployments-framework v0.25.0 h1:4RKGSyo+nErBSfmi9zsSnDr1jMGyWEvOLM91r9E0bAI=
github.com/smartcontractkit/chainlink-deployments-framework v0.25.0/go.mod h1:gnpB4ag+JcerUbkVRTSa0WVjuJfOIqObkEs5hNcjv54=
github.com/smartcontractkit/chainlink-evm v0.3.2 h1:cdwDu0peeoK0jCzUV9FQkOiCeKJqG2SBohJO3P50dd4=
github.com/smartcontractkit/chainlink-evm v0.3.2/go.mod h1:s+4876jB9bAnX+b46t/Q757IixXHiwtgW82GO0fdsqw=
github.com/smartcontractkit/chainlink-evm v0.3.3-0.20250903140346-aacd485a7dea h1:qOs/dy1w7QO43pqeSD9U+4iF4dRpWblN4Iiye1yLw0s=
github.com/smartcontractkit/chainlink-evm v0.3.3-0.20250903140346-aacd485a7dea/go.mod h1:s+4876jB9bAnX+b46t/Q757IixXHiwtgW82GO0fdsqw=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250827130336-5922343458be h1:NRldnH+Q6v8TjO3sBGo1mL/VRGeaPVneY2L13tCx114=
github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20250827130336-5922343458be/go.mod h1:3Lsp38qxen9PABVF+O5eocveQev+hyo9HLAgRodBD4Q=
github.com/smartcontractkit/chainlink-feeds v0.1.2-0.20250227211209-7cd000095135 h1:8u9xUrC+yHrTDexOKDd+jrA6LCzFFHeX1G82oj2fsSI=
Expand Down
4 changes: 2 additions & 2 deletions core/services/feeds/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type = "offchainreporting"
schemaVersion = 1
name = "%s"
externalJobID = "%s"
evmChainID = 0
evmChainID = "%s"
contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C"
p2pv2Bootstrappers = ["12D3KooWHfYFQ8hGttAYbMCevQVESEQhzJAqFZokMVtom8bNxwGq@127.0.0.1:5001"]
keyBundleID = "f5bf259689b26f1374efb3c9a9868796953a0f814bb2d39b968d0e61b58620a5"
Expand Down Expand Up @@ -888,7 +888,7 @@ func Test_Service_ProposeJob(t *testing.T) {
idOCR1 = int64(2)
remoteUUIDOCR1 = uuid.New()
ocr1NameAndExternalJobID = uuid.New()
ocr1Spec = fmt.Sprintf(OCR1TestSpecTemplate, ocr1NameAndExternalJobID, ocr1NameAndExternalJobID)
ocr1Spec = fmt.Sprintf(OCR1TestSpecTemplate, ocr1NameAndExternalJobID, ocr1NameAndExternalJobID, testutils.FixtureChainID.String())
argsOCR1 = &feeds.ProposeJobArgs{
FeedsManagerID: 1,
RemoteUUID: remoteUUIDOCR1,
Expand Down
2 changes: 1 addition & 1 deletion core/services/headreporter/head_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

func NewHead() evmtypes.Head {
return evmtypes.Head{Number: 42, EVMChainID: ubig.NewI(0)}
return evmtypes.Head{Number: 42, EVMChainID: ubig.New(testutils.FixtureChainID)}
}

func Test_HeadReporterService(t *testing.T) {
Expand Down
19 changes: 9 additions & 10 deletions core/services/headreporter/prometheus_reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package headreporter_test

import (
"fmt"
"math/big"
"testing"
"time"

Expand Down Expand Up @@ -33,9 +32,9 @@ func Test_PrometheusReporter(t *testing.T) {
db := pgtest.NewSqlxDB(t)

backend := headreporter.NewMockPrometheusBackend(t)
backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(0)).Return()
backend.On("SetMaxUnconfirmedAge", big.NewInt(0), float64(0)).Return()
backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(0)).Return()
backend.On("SetUnconfirmedTransactions", evmtestutils.FixtureChainID, int64(0)).Return()
backend.On("SetMaxUnconfirmedAge", evmtestutils.FixtureChainID, float64(0)).Return()
backend.On("SetMaxUnconfirmedBlocks", evmtestutils.FixtureChainID, int64(0)).Return()

reporter := headreporter.NewLegacyEVMPrometheusReporter(db, newLegacyChainContainer(t, db))
reporter.SetBackend(backend)
Expand Down Expand Up @@ -74,11 +73,11 @@ func Test_PrometheusReporter(t *testing.T) {
require.NoError(t, txStore.UpdateTxAttemptBroadcastBeforeBlockNum(testutils.Context(t), etx.ID, 7))

backend := headreporter.NewMockPrometheusBackend(t)
backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(3)).Return()
backend.On("SetMaxUnconfirmedAge", big.NewInt(0), mock.MatchedBy(func(s float64) bool {
backend.On("SetUnconfirmedTransactions", evmtestutils.FixtureChainID, int64(3)).Return()
backend.On("SetMaxUnconfirmedAge", evmtestutils.FixtureChainID, mock.MatchedBy(func(s float64) bool {
return s > 0
})).Return()
backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(35)).Return()
backend.On("SetMaxUnconfirmedBlocks", evmtestutils.FixtureChainID, int64(35)).Return()

reporter := headreporter.NewLegacyEVMPrometheusReporter(db, newLegacyChainContainer(t, db))
reporter.SetBackend(backend)
Expand All @@ -103,9 +102,9 @@ func Test_PrometheusReporter(t *testing.T) {
evmtestutils.MustInsertUnfinishedPipelineTaskRun(t, db, 2)

backend := headreporter.NewMockPrometheusBackend(t)
backend.On("SetUnconfirmedTransactions", big.NewInt(0), int64(0)).Return()
backend.On("SetMaxUnconfirmedAge", big.NewInt(0), float64(0)).Return()
backend.On("SetMaxUnconfirmedBlocks", big.NewInt(0), int64(0)).Return()
backend.On("SetUnconfirmedTransactions", evmtestutils.FixtureChainID, int64(0)).Return()
backend.On("SetMaxUnconfirmedAge", evmtestutils.FixtureChainID, float64(0)).Return()
backend.On("SetMaxUnconfirmedBlocks", evmtestutils.FixtureChainID, int64(0)).Return()

reporter := headreporter.NewLegacyEVMPrometheusReporter(db, newLegacyChainContainer(t, db))
reporter.SetBackend(backend)
Expand Down
18 changes: 10 additions & 8 deletions core/services/job/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/jmoiron/sqlx"

"github.com/smartcontractkit/chainlink-evm/pkg/client/clienttest"
chainlinkevmbig "github.com/smartcontractkit/chainlink-evm/pkg/utils/big"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/evmtest"
Expand All @@ -34,7 +35,7 @@ const (
type = "offchainreporting"
schemaVersion = 1
contractAddress = "%s"
evmChainID = "0"
evmChainID = "%s"
p2pv2Bootstrappers = ["12D3KooWHfYFQ8hGttAYbMCevQVESEQhzJAqFZokMVtom8bNxwGq@127.0.0.1:5001"]
isBootstrapPeer = false
keyBundleID = "%s"
Expand Down Expand Up @@ -107,7 +108,7 @@ ds1 -> ds1_parse -> ds1_multiply;
transmitterAddress = "%s"
keyBundleID = "%s"
observationTimeout = "10s"
evmChainID = "0"
evmChainID = "%s"
observationSource = """
ds1 [type=http method=GET url="%s" allowunrestrictednetworkaccess="true" %s];
ds1_parse [type=jsonparse path="USD" lax=true];
Expand All @@ -118,14 +119,14 @@ ds1 -> ds1_parse;
type = "offchainreporting"
schemaVersion = 1
contractAddress = "%s"
evmChainID = "0"
evmChainID = "%s"
isBootstrapPeer = true
`
ocrJobSpecText = `
type = "offchainreporting"
schemaVersion = 1
contractAddress = "%s"
evmChainID = "0"
evmChainID = "%s"
p2pPeerID = "%s"
p2pv2Bootstrappers = ["12D3KooWHfYFQ8hGttAYbMCevQVESEQhzJAqFZokMVtom8bNxwGq@127.0.0.1:5001"]
isBootstrapPeer = false
Expand Down Expand Up @@ -162,7 +163,7 @@ func makeOCRJobSpec(t *testing.T, transmitterAddress common.Address, b1, b2 stri

peerID := cltest.DefaultP2PPeerID
ocrKeyID := cltest.DefaultOCRKeyBundleID
jobSpecText := fmt.Sprintf(ocrJobSpecText, testutils.NewAddress().Hex(), peerID, ocrKeyID, transmitterAddress.Hex(), b1, b2)
jobSpecText := fmt.Sprintf(ocrJobSpecText, testutils.NewAddress().Hex(), testutils.FixtureChainID.String(), peerID, ocrKeyID, transmitterAddress.Hex(), b1, b2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit/ You don't have to call String() with %s:

Suggested change
jobSpecText := fmt.Sprintf(ocrJobSpecText, testutils.NewAddress().Hex(), testutils.FixtureChainID.String(), peerID, ocrKeyID, transmitterAddress.Hex(), b1, b2)
jobSpecText := fmt.Sprintf(ocrJobSpecText, testutils.NewAddress().Hex(), testutils.FixtureChainID, peerID, ocrKeyID, transmitterAddress.Hex(), b1, b2)


dbSpec := job.Job{
ExternalJobID: uuid.New(),
Expand Down Expand Up @@ -203,14 +204,15 @@ func makeMinimalHTTPOracleSpec(t *testing.T, db *sqlx.DB, cfg chainlink.GeneralC
ContractConfigTrackerSubscribeInterval: models.Interval(2 * time.Minute),
ContractConfigTrackerPollInterval: models.Interval(1 * time.Minute),
ContractConfigConfirmations: uint16(3),
EVMChainID: chainlinkevmbig.New(testutils.FixtureChainID),
}
var os = job.Job{
Name: null.NewString("a job", true),
Type: job.OffchainReporting,
SchemaVersion: 1,
ExternalJobID: uuid.New(),
}
s := fmt.Sprintf(minimalNonBootstrapTemplate, contractAddress, transmitterAddress, keyBundle, fetchUrl, timeout)
s := fmt.Sprintf(minimalNonBootstrapTemplate, contractAddress, transmitterAddress, keyBundle, testutils.FixtureChainID.String(), fetchUrl, timeout)
keyStore := cltest.NewKeyStore(t, db)
legacyChains := evmtest.NewLegacyChains(t, evmtest.TestChainOpts{
ChainConfigs: cfg.EVMConfigs(),
Expand Down Expand Up @@ -240,15 +242,15 @@ func MakeVoterTurnoutOCRJobSpecWithHTTPURL(t *testing.T, transmitterAddress comm
t.Helper()
ocrKeyID := cltest.DefaultOCRKeyBundleID
ds := fmt.Sprintf(voterTurnoutDataSourceTemplate, b1, httpURL, b2)
voterTurnoutJobSpec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), ocrKeyID, transmitterAddress.Hex(), ds)
voterTurnoutJobSpec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), testutils.FixtureChainID.String(), ocrKeyID, transmitterAddress.Hex(), ds)
return makeOCRJobSpecFromToml(t, voterTurnoutJobSpec)
}

func makeSimpleFetchOCRJobSpecWithHTTPURL(t *testing.T, transmitterAddress common.Address, httpURL string, lax bool) *job.Job {
t.Helper()
ocrKeyID := cltest.DefaultOCRKeyBundleID
ds := fmt.Sprintf(simpleFetchDataSourceTemplate, httpURL, lax)
simpleFetchJobSpec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), ocrKeyID, transmitterAddress.Hex(), ds)
simpleFetchJobSpec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), testutils.FixtureChainID.String(), ocrKeyID, transmitterAddress.Hex(), ds)
return makeOCRJobSpecFromToml(t, simpleFetchJobSpec)
}

Expand Down
16 changes: 8 additions & 8 deletions core/services/job/runner_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func TestRunner(t *testing.T) {
jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, fmt.Sprintf(`
type = "offchainreporting"
schemaVersion = 1
evmChainID = 0
evmChainID = "%s"
transmitterID = "%s"
contractAddress = "0x613a38AC1659769640aaE063C651F48E0250454C"
isBootstrapPeer = false
Expand All @@ -231,7 +231,7 @@ func TestRunner(t *testing.T) {
ds1 -> ds1_parse -> ds1_multiply -> answer1;
answer1 [type=median index=0];
"""
`, placeHolderAddress.String()))
`, testutils.FixtureChainID.String(), placeHolderAddress.String()))
require.NoError(t, err)
// Should error creating it
err = jobORM.CreateJob(ctx, &jb)
Expand Down Expand Up @@ -455,9 +455,9 @@ answer1 [type=median index=0];
schemaVersion = 1
contractAddress = "%s"
isBootstrapPeer = true
evmChainID = "0"
evmChainID = "%s"
`
s = fmt.Sprintf(s, cltest.NewEIP55Address())
s = fmt.Sprintf(s, cltest.NewEIP55Address(), testutils.FixtureChainID.String())
jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, s)
require.NoError(t, err)
err = toml.Unmarshal([]byte(s), &jb)
Expand Down Expand Up @@ -493,7 +493,7 @@ answer1 [type=median index=0];
kb, err := keyStore.OCR().Create(ctx)
require.NoError(t, err)

s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), "http://blah.com", "")
s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), testutils.FixtureChainID.String(), "http://blah.com", "")
jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, s)
require.NoError(t, err)
err = toml.Unmarshal([]byte(s), &jb)
Expand Down Expand Up @@ -525,7 +525,7 @@ answer1 [type=median index=0];
})

t.Run("test min bootstrap", func(t *testing.T) {
s := fmt.Sprintf(minimalBootstrapTemplate, cltest.NewEIP55Address())
s := fmt.Sprintf(minimalBootstrapTemplate, cltest.NewEIP55Address(), testutils.FixtureChainID.String())
jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains, s)
require.NoError(t, err)
err = toml.Unmarshal([]byte(s), &jb)
Expand Down Expand Up @@ -585,7 +585,7 @@ answer1 [type=median index=0];
kb, err := keyStore.OCR().Create(ctx)
require.NoError(t, err)

s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), "http://blah.com", "")
s := fmt.Sprintf(minimalNonBootstrapTemplate, cltest.NewEIP55Address(), transmitterAddress.Hex(), kb.ID(), testutils.FixtureChainID.String(), "http://blah.com", "")
jb, err := ocr.ValidatedOracleSpecToml(config, legacyChains2, s)
require.NoError(t, err)
err = toml.Unmarshal([]byte(s), &jb)
Expand Down Expand Up @@ -635,7 +635,7 @@ answer1 [type=median index=0];
// Create a keystore with an ocr key bundle and p2p key.
kb, err := keyStore.OCR().Create(ctx)
require.NoError(t, err)
spec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), kb.ID(), transmitterAddress.Hex(), fmt.Sprintf(simpleFetchDataSourceTemplate, "blah", true))
spec := fmt.Sprintf(ocrJobSpecTemplate, testutils.NewAddress().Hex(), testutils.FixtureChainID.String(), kb.ID(), transmitterAddress.Hex(), fmt.Sprintf(simpleFetchDataSourceTemplate, "blah", true))
jb := makeOCRJobSpecFromToml(t, spec)

// Create an OCR job
Expand Down
4 changes: 2 additions & 2 deletions core/services/keystore/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,13 +706,13 @@ func Test_EthKeyStore_CheckEnabled(t *testing.T) {
t.Run("returns error when key exists but has never been enabled (no state) for the given chain", func(t *testing.T) {
err := ks.CheckEnabled(ctx, addr3, testutils.FixtureChainID)
assert.Error(t, err)
require.Contains(t, err.Error(), fmt.Sprintf("eth key with address %s exists but is has not been enabled for chain 0 (enabled only for chain IDs: 1337)", addr3.Hex()))
require.Contains(t, err.Error(), fmt.Sprintf("eth key with address %s exists but is has not been enabled for chain %s (enabled only for chain IDs: 1337)", addr3.Hex(), testutils.FixtureChainID.String()))
})

t.Run("returns error when key exists but is disabled for the given chain", func(t *testing.T) {
err := ks.CheckEnabled(ctx, addr2, testutils.SimulatedChainID)
assert.Error(t, err)
require.Contains(t, err.Error(), fmt.Sprintf("eth key with address %s exists but is disabled for chain 1337 (enabled only for chain IDs: 0)", addr2.Hex()))
require.Contains(t, err.Error(), fmt.Sprintf("eth key with address %s exists but is disabled for chain 1337 (enabled only for chain IDs: %s)", addr2.Hex(), testutils.FixtureChainID.String()))
})
}

Expand Down
Loading
Loading