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

chainconfig: axe chainconfig.FinalityDepth #110

Merged
merged 2 commits into from
Sep 10, 2024
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
9 changes: 0 additions & 9 deletions chainconfig/chainconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ type ChainConfig struct {
// This is only applicable for some chains, such as L2's.
DAGasPriceDeviationPPB cciptypes.BigInt `json:"daGasPriceDeviationPPB"`

// FinalityDepth is the number of confirmations before a block is considered finalized.
// If set to -1, finality tags will be used.
// 0 is not a valid value.
FinalityDepth int64 `json:"finalityDepth"`

// OptimisticConfirmations is the number of confirmations of a chain event before
// it is considered optimistically confirmed (i.e not necessarily finalized).
OptimisticConfirmations uint32 `json:"optimisticConfirmations"`
Expand All @@ -42,10 +37,6 @@ func (cc ChainConfig) Validate() error {
// No validation for DAGasPriceDeviationPPB as it is optional
// and only applicable to L2's.

if cc.FinalityDepth == 0 {
return errors.New("FinalityDepth not set")
}

if cc.OptimisticConfirmations == 0 {
return errors.New("OptimisticConfirmations not set")
}
Expand Down
25 changes: 0 additions & 25 deletions chainconfig/chainconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ func TestChainConfig_Validate(t *testing.T) {
type fields struct {
GasPriceDeviationPPB cciptypes.BigInt
DAGasPriceDeviationPPB cciptypes.BigInt
FinalityDepth int64
OptimisticConfirmations uint32
}
tests := []struct {
Expand All @@ -24,17 +23,6 @@ func TestChainConfig_Validate(t *testing.T) {
fields{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
FinalityDepth: 1,
OptimisticConfirmations: 1,
},
false,
},
{
"valid, finality tags enabled",
fields{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
FinalityDepth: -1,
OptimisticConfirmations: 1,
},
false,
Expand All @@ -44,17 +32,6 @@ func TestChainConfig_Validate(t *testing.T) {
fields{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(0)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
FinalityDepth: 1,
OptimisticConfirmations: 1,
},
true,
},
{
"invalid, finality depth not set",
fields{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
FinalityDepth: 0,
OptimisticConfirmations: 1,
},
true,
Expand All @@ -64,7 +41,6 @@ func TestChainConfig_Validate(t *testing.T) {
fields{
GasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
DAGasPriceDeviationPPB: cciptypes.BigInt{Int: big.NewInt(1)},
FinalityDepth: 1,
OptimisticConfirmations: 0,
},
true,
Expand All @@ -75,7 +51,6 @@ func TestChainConfig_Validate(t *testing.T) {
cc := ChainConfig{
GasPriceDeviationPPB: tt.fields.GasPriceDeviationPPB,
DAGasPriceDeviationPPB: tt.fields.DAGasPriceDeviationPPB,
FinalityDepth: tt.fields.FinalityDepth,
OptimisticConfirmations: tt.fields.OptimisticConfirmations,
}
if err := cc.Validate(); (err != nil) != tt.wantErr {
Expand Down
6 changes: 3 additions & 3 deletions commit/plugin_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ func TestPlugin_E2E_AllNodesAgree(t *testing.T) {

peerIDsMap := mapset.NewSet(peerIDs...)
homeChainConfig := map[ccipocr3.ChainSelector]reader.ChainConfig{
destChain: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{FinalityDepth: 1}},
sourceChain1: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{FinalityDepth: 1}},
sourceChain2: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{FinalityDepth: 1}},
destChain: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{}},
sourceChain1: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{}},
sourceChain2: {FChain: 1, SupportedNodes: peerIDsMap, Config: chainconfig.ChainConfig{}},
}

offRampNextSeqNum := map[ccipocr3.ChainSelector]ccipocr3.SeqNum{
Expand Down
8 changes: 2 additions & 6 deletions execute/plugin_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ func setupSimpleTest(
Readers: []libocrtypes.PeerID{
{1}, {2}, {3},
},
Config: mustEncodeChainConfig(chainconfig.ChainConfig{
FinalityDepth: 1,
}),
Config: mustEncodeChainConfig(chainconfig.ChainConfig{}),
},
}, {
ChainSelector: dstSelector,
Expand All @@ -228,9 +226,7 @@ func setupSimpleTest(
Readers: []libocrtypes.PeerID{
{1}, {2}, {3},
},
Config: mustEncodeChainConfig(chainconfig.ChainConfig{
FinalityDepth: 1,
}),
Config: mustEncodeChainConfig(chainconfig.ChainConfig{}),
},
},
}
Expand Down
4 changes: 1 addition & 3 deletions internal/reader/home_chain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ func TestHomeChainConfigPoller_HealthReport(t *testing.T) {
}

func Test_PollingWorking(t *testing.T) {
chainConfig := chainconfig.ChainConfig{
FinalityDepth: 1,
}
chainConfig := chainconfig.ChainConfig{}
encodedChainConfig, err := chainconfig.EncodeChainConfig(chainConfig)
require.NoError(t, err)
onChainConfigs := []ChainConfigInfo{
Expand Down
Loading