Skip to content

Commit

Permalink
RMNHome f to fObserve
Browse files Browse the repository at this point in the history
  • Loading branch information
asoliman92 committed Dec 18, 2024
1 parent f742191 commit 0c099d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pkg/reader/rmn_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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"`
}

Expand Down
18 changes: 9 additions & 9 deletions pkg/reader/rmn_home_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -447,7 +447,7 @@ func createTestRMNHomeConfigs(
SourceChains: []SourceChain{
{
ChainSelector: cciptypes.ChainSelector(id),
F: uint64(id),
FObserve: uint64(id),
ObserverNodesBitmap: big.NewInt(int64(id)),
},
},
Expand Down

0 comments on commit 0c099d8

Please sign in to comment.