From 0c099d835abf04bec39bb2a76fb4893e3417878e Mon Sep 17 00:00:00 2001 From: asoliman Date: Wed, 18 Dec 2024 14:12:11 +0200 Subject: [PATCH] RMNHome f to fObserve --- pkg/reader/rmn_home.go | 4 ++-- pkg/reader/rmn_home_test.go | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/reader/rmn_home.go b/pkg/reader/rmn_home.go index 6fc52e24..3a72a4c8 100644 --- a/pkg/reader/rmn_home.go +++ b/pkg/reader/rmn_home.go @@ -304,7 +304,7 @@ func convertOnChainConfigToRMNHomeChainConfig( homeFMap := make(map[cciptypes.ChainSelector]int) for _, chain := range versionedConfig.DynamicConfig.SourceChains { - homeFMap[chain.ChainSelector] = int(chain.F) + homeFMap[chain.ChainSelector] = int(chain.FObserve) for j := 0; j < len(nodes); j++ { isObserver, err := IsNodeObserver(chain, j, len(nodes)) if err != nil { @@ -388,7 +388,7 @@ type Node struct { // SourceChain mirrors RMNHome.sol's SourceChain struct type SourceChain struct { ChainSelector cciptypes.ChainSelector `json:"chainSelector"` - F uint64 `json:"f"` // previously: MinObservers + FObserve uint64 `json:"f"` // previously: MinObservers ObserverNodesBitmap *big.Int `json:"observerNodesBitmap"` } diff --git a/pkg/reader/rmn_home_test.go b/pkg/reader/rmn_home_test.go index cb3a3275..6815c186 100644 --- a/pkg/reader/rmn_home_test.go +++ b/pkg/reader/rmn_home_test.go @@ -323,7 +323,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Node is observer", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(7), // 111 in binary }, nodeIndex: 1, @@ -335,7 +335,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Node is not observer", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(5), // 101 in binary }, nodeIndex: 1, @@ -347,7 +347,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Node index out of range (high)", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(7), // 111 in binary }, nodeIndex: 3, @@ -359,7 +359,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Negative node index", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(7), // 111 in binary }, nodeIndex: -1, @@ -371,7 +371,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Invalid bitmap (out of bounds)", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(8), // 1000 in binary }, nodeIndex: 0, @@ -383,7 +383,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Zero total nodes", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(1), }, nodeIndex: 0, @@ -395,7 +395,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Total nodes exceeds 256", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 3, + FObserve: 3, ObserverNodesBitmap: big.NewInt(1), }, nodeIndex: 0, @@ -407,7 +407,7 @@ func TestIsNodeObserver(t *testing.T) { name: "Last valid node is observer", sourceChain: SourceChain{ ChainSelector: cciptypes.ChainSelector(1), - F: 1, + FObserve: 1, ObserverNodesBitmap: new(big.Int).SetBit(big.NewInt(0), 255, 1), // Only the 256th bit is set }, nodeIndex: 255, @@ -447,7 +447,7 @@ func createTestRMNHomeConfigs( SourceChains: []SourceChain{ { ChainSelector: cciptypes.ChainSelector(id), - F: uint64(id), + FObserve: uint64(id), ObserverNodesBitmap: big.NewInt(int64(id)), }, },