Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase finality depth for chains with 1 finality depth to 10 #12756

Merged
merged 42 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f8b59c6
change finality depth from 1 to 10
poopoothegorilla May 3, 2024
1c80e5a
run make config-docs
poopoothegorilla May 3, 2024
9621f45
update changeset
poopoothegorilla May 3, 2024
fd3e9d9
Merge branch 'develop' into jtw/increase-instant-finality-depth
poopoothegorilla May 3, 2024
1006201
fix HistoryDepth
poopoothegorilla May 3, 2024
fa3a8a8
make config-docs
poopoothegorilla May 3, 2024
04ad4eb
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 13, 2024
bad2631
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 15, 2024
728d123
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 15, 2024
276fa00
Added LogPoller replay
silaslenihan May 15, 2024
b60b47f
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 15, 2024
46985d7
linting fix
silaslenihan May 15, 2024
59e10d3
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 15, 2024
f7cb519
Added replay fix for MercuryV1 integration test
silaslenihan May 15, 2024
ea9dfae
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 15, 2024
4e1bea8
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 16, 2024
6fadc64
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 17, 2024
9286503
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 17, 2024
53af3bc
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 20, 2024
9aa3532
Updated finality depth commitments
silaslenihan May 20, 2024
b45585f
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 20, 2024
e48ba39
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 21, 2024
b0ab410
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 21, 2024
03eb076
linting issue fix
silaslenihan May 22, 2024
3f718f0
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
519640a
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
a20c4b2
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
82832fd
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
9d729f9
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
635ee51
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 22, 2024
58afd44
updated comments in tests
silaslenihan May 23, 2024
0d6a7ec
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 23, 2024
cf79cd9
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 28, 2024
a1bbff3
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 28, 2024
272e5e3
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 28, 2024
f3bbe6e
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 29, 2024
4af2958
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 30, 2024
18113ff
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 30, 2024
5eca3b4
Merge branch 'develop' into jtw/increase-instant-finality-depth
prashantkumar1982 May 30, 2024
fd7a489
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan May 31, 2024
03d7546
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan Jun 1, 2024
f20cfc3
Merge branch 'develop' into jtw/increase-instant-finality-depth
silaslenihan Jun 3, 2024
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/orange-years-divide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

update finality depth for chains #nops
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Avalanche_Fuji.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '43113'
FinalityDepth = 1
FinalityDepth = 10
LinkContractAddress = '0x0b9d5D9136855f6FEc3c0993feE6E9CE8a297846'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '43114'
FinalityDepth = 1
FinalityDepth = 10
LinkContractAddress = '0x5947BB275c521040051D82396192181b413227A3'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Celo_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '42220'
ChainType = 'celo'
FinalityDepth = 1
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '1m'
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Celo_Testnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '44787'
ChainType = 'celo'
FinalityDepth = 1
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '1m'
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Klaytn_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '8217'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '30s'
OCR.ContractConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Klaytn_Testnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '1001'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '30s'
OCR.ContractConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Metis_Mainnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ChainID = '1088'
ChainType = 'metis'
# Sequencer offers absolute finality
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '0'
OCR.ContractConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Metis_Rinkeby.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '588'
ChainType = 'metis'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '0'
OCR.ContractConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Metis_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '59902'
ChainType = 'metis'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '0'
OCR.ContractConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Scroll_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '534352'
FinalityDepth = 1
FinalityDepth = 10
ChainType = 'scroll'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Scroll_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '534351'
FinalityDepth = 1
FinalityDepth = 10
ChainType = 'scroll'
LogPollInterval = '3s'
MinIncomingConfirmations = 1
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/Simulated.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ChainID = '1337'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
MinContractPayment = '100'
NoNewHeadsThreshold = '0s'
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/WeMix_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '1111'
ChainType = 'wemix'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
# WeMix emits a block every 1 second, regardless of transactions
LogPollInterval = '3s'
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/config/toml/defaults/WeMix_Testnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '1112'
ChainType = 'wemix'
FinalityDepth = 1
FinalityDepth = 10
MinIncomingConfirmations = 1
# WeMix emits a block every 1 second, regardless of transactions
LogPollInterval = '3s'
Expand Down
4 changes: 2 additions & 2 deletions core/chains/evm/config/toml/defaults/zkSync_Goerli.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '280'
ChainType = 'zksync'
FinalityDepth = 1
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '1m'
Expand All @@ -11,4 +11,4 @@ PriceMax = 18446744073709551615
PriceMin = 0

[HeadTracker]
HistoryDepth = 5
HistoryDepth = 50
4 changes: 2 additions & 2 deletions core/chains/evm/config/toml/defaults/zkSync_Mainnet.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '324'
ChainType = 'zksync'
FinalityDepth = 1
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '1m'
Expand All @@ -11,4 +11,4 @@ PriceMax = 18446744073709551615
PriceMin = 0

[HeadTracker]
HistoryDepth = 5
HistoryDepth = 50
4 changes: 2 additions & 2 deletions core/chains/evm/config/toml/defaults/zkSync_Sepolia.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ChainID = '300'
ChainType = 'zksync'
FinalityDepth = 1
FinalityDepth = 10
LogPollInterval = '5s'
MinIncomingConfirmations = 1
NoNewHeadsThreshold = '1m'
Expand All @@ -11,4 +11,4 @@ PriceMax = 18446744073709551615
PriceMin = 0

[HeadTracker]
HistoryDepth = 5
HistoryDepth = 50
2 changes: 1 addition & 1 deletion core/scripts/ocr2vrf/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var (
Enabled = true

[[EVM]]
FinalityDepth = 1
FinalityDepth = 10
ChainID = '%d'

[EVM.Transactions]
Expand Down
9 changes: 4 additions & 5 deletions core/services/ocr2/plugins/llo/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,20 +148,19 @@ func TestIntegration_LLO(t *testing.T) {
})
}

configDigest := setConfig(t, steve, backend, verifierContract, verifierAddress, nodes, oracles)
channelDefinitions := setChannelDefinitions(t, steve, backend, configStoreContract, streams)

// Bury everything with finality depth
// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := nodes[0].App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

configDigest := setConfig(t, steve, backend, verifierContract, verifierAddress, nodes, oracles)
channelDefinitions := setChannelDefinitions(t, steve, backend, configStoreContract, streams)

addBootstrapJob(t, bootstrapNode, chainID, verifierAddress, "job-1")
addOCRJobs(t, streams, serverPubKey, serverURL, verifierAddress, bootstrapPeerID, bootstrapNodePort, nodes, configStoreAddress, clientPubKeys, chainID, fromBlock)

t.Run("receives at least one report per feed from each oracle when EAs are at 100% reliability", func(t *testing.T) {
// Expect at least one report per channel from each oracle (keyed by transmitter ID)
seen := make(map[ocr2types.Account]map[llotypes.ChannelID]struct{})
Expand Down
73 changes: 38 additions & 35 deletions core/services/ocr2/plugins/mercury/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ func integration_MercuryV1(t *testing.T) {
detectPanicLogs(t, logObservers)
})
lggr := logger.TestLogger(t)
const fromBlock = 1 // cannot use zero, start from block 1
testStartTimeStamp := uint32(time.Now().Unix())

// test vars
Expand Down Expand Up @@ -185,6 +184,16 @@ func integration_MercuryV1(t *testing.T) {
bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb}
logObservers = append(logObservers, observedLogs)

// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

fromBlock := int(finalityDepth) // cannot use zero, start from finality depth

// Set up n oracles
var (
oracles []confighelper.OracleIdentityExtra
Expand Down Expand Up @@ -216,7 +225,8 @@ func integration_MercuryV1(t *testing.T) {

createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) {
bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
b, err := io.ReadAll(req.Body)
var b []byte
b, err = io.ReadAll(req.Body)
require.NoError(t, err)
require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b))

Expand All @@ -225,12 +235,12 @@ func integration_MercuryV1(t *testing.T) {
res.WriteHeader(http.StatusOK)
val := decimal.NewFromBigInt(p, 0).Div(decimal.NewFromInt(multiplier)).Add(decimal.NewFromInt(int64(i)).Div(decimal.NewFromInt(100))).String()
resp := fmt.Sprintf(`{"result": %s}`, val)
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
} else {
res.WriteHeader(http.StatusInternalServerError)
resp := `{"error": "pError test error"}`
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
}
}))
Expand Down Expand Up @@ -272,7 +282,6 @@ func integration_MercuryV1(t *testing.T) {
)
}
}

// Setup config on contract
onchainConfig, err := (datastreamsmercury.StandardOnchainConfigCodec{}).Encode(rawOnchainConfig)
require.NoError(t, err)
Expand Down Expand Up @@ -334,14 +343,6 @@ func integration_MercuryV1(t *testing.T) {
backend.Commit()
}

// Bury it with finality depth
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

t.Run("receives at least one report per feed from each oracle when EAs are at 100% reliability", func(t *testing.T) {
// Expect at least one report per feed from each oracle
seen := make(map[[32]byte]map[credentials.StaticSizedPublicKey]struct{})
Expand Down Expand Up @@ -539,6 +540,14 @@ func integration_MercuryV2(t *testing.T) {
bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb}
logObservers = append(logObservers, observedLogs)

// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

// Set up n oracles
var (
oracles []confighelper.OracleIdentityExtra
Expand Down Expand Up @@ -571,7 +580,8 @@ func integration_MercuryV2(t *testing.T) {

createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) {
bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
b, err := io.ReadAll(req.Body)
var b []byte
b, err = io.ReadAll(req.Body)
require.NoError(t, err)
require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b))

Expand All @@ -580,12 +590,12 @@ func integration_MercuryV2(t *testing.T) {
res.WriteHeader(http.StatusOK)
val := decimal.NewFromBigInt(p, 0).Div(decimal.NewFromInt(multiplier)).Add(decimal.NewFromInt(int64(i)).Div(decimal.NewFromInt(100))).String()
resp := fmt.Sprintf(`{"result": %s}`, val)
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
} else {
res.WriteHeader(http.StatusInternalServerError)
resp := `{"error": "pError test error"}`
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
}
}))
Expand Down Expand Up @@ -673,14 +683,6 @@ func integration_MercuryV2(t *testing.T) {
backend.Commit()
}

// Bury it with finality depth
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

runTestSetup := func() {
// Expect at least one report per feed from each oracle
seen := make(map[[32]byte]map[credentials.StaticSizedPublicKey]struct{})
Expand Down Expand Up @@ -828,6 +830,14 @@ func integration_MercuryV3(t *testing.T) {
bootstrapNode := Node{App: appBootstrap, KeyBundle: bootstrapKb}
logObservers = append(logObservers, observedLogs)

// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

// Set up n oracles
var (
oracles []confighelper.OracleIdentityExtra
Expand Down Expand Up @@ -860,7 +870,8 @@ func integration_MercuryV3(t *testing.T) {

createBridge := func(name string, i int, p *big.Int, borm bridges.ORM) (bridgeName string) {
bridge := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
b, err := io.ReadAll(req.Body)
var b []byte
b, err = io.ReadAll(req.Body)
require.NoError(t, err)
require.Equal(t, `{"data":{"from":"ETH","to":"USD"}}`, string(b))

Expand All @@ -869,12 +880,12 @@ func integration_MercuryV3(t *testing.T) {
res.WriteHeader(http.StatusOK)
val := decimal.NewFromBigInt(p, 0).Div(decimal.NewFromInt(multiplier)).Add(decimal.NewFromInt(int64(i)).Div(decimal.NewFromInt(100))).String()
resp := fmt.Sprintf(`{"result": %s}`, val)
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
} else {
res.WriteHeader(http.StatusInternalServerError)
resp := `{"error": "pError test error"}`
_, err := res.Write([]byte(resp))
_, err = res.Write([]byte(resp))
require.NoError(t, err)
}
}))
Expand Down Expand Up @@ -965,14 +976,6 @@ func integration_MercuryV3(t *testing.T) {
backend.Commit()
}

// Bury it with finality depth
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

runTestSetup := func(reqs chan request) {
// Expect at least one report per feed from each oracle, per server
seen := make(map[[32]byte]map[credentials.StaticSizedPublicKey]struct{})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,15 @@ func setupNodes(t *testing.T, nodeKeys [5]ethkey.KeyV2, registry *iregistry21.IK
bootstrapNode := Node{
appBootstrap, bootstrapTransmitter, bootstrapKb,
}

// Commit blocks to finality depth to ensure LogPoller has finalized blocks to read from
ch, err := bootstrapNode.App.GetRelayers().LegacyEVMChains().Get(testutils.SimulatedChainID.String())
require.NoError(t, err)
finalityDepth := ch.Config().EVM().FinalityDepth()
for i := 0; i < int(finalityDepth); i++ {
backend.Commit()
}

var (
oracles []confighelper.OracleIdentityExtra
nodes []Node
Expand Down
Loading
Loading