Skip to content

Commit

Permalink
RMNRemote f to fSign
Browse files Browse the repository at this point in the history
  • Loading branch information
asoliman92 committed Dec 18, 2024
1 parent 0c099d8 commit be53eab
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
4 changes: 2 additions & 2 deletions commit/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func Test_maxObservationLength(t *testing.T) {
ContractAddress: make([]byte, 20),
ConfigDigest: [32]byte{},
Signers: make([]rmntypes.RemoteSignerInfo, estimatedMaxRmnNodesCount),
F: math.MaxUint64,
FSign: math.MaxUint64,
ConfigVersion: math.MaxUint32,
RmnReportVersion: [32]byte{},
},
Expand Down Expand Up @@ -175,7 +175,7 @@ func Test_maxOutcomeLength(t *testing.T) {
ContractAddress: make([]byte, 20),
ConfigDigest: [32]byte{},
Signers: make([]rmntypes.RemoteSignerInfo, estimatedMaxRmnNodesCount),
F: math.MaxUint64,
FSign: math.MaxUint64,
ConfigVersion: math.MaxUint32,
RmnReportVersion: [32]byte{},
},
Expand Down
2 changes: 1 addition & 1 deletion commit/merkleroot/observation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ func Test_shouldSkipRMNVerification(t *testing.T) {

prevOutcome := Outcome{}
if !tc.rmnRemoteConfigEmpty {
prevOutcome.RMNRemoteCfg = rmntypes.RemoteConfig{F: 1}
prevOutcome.RMNRemoteCfg = rmntypes.RemoteConfig{FSign: 1}
}

shouldSkip, err := shouldSkipRMNVerification(tc.nextProcessorState, q, prevOutcome)
Expand Down
2 changes: 1 addition & 1 deletion commit/merkleroot/rmn/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (c *controller) getRmnReportSignatures(
},
AttributedSignedObservations: transformAndSortObservations(rmnSignedObservations),
}
remoteF := int(rmnRemoteCfg.F)
remoteF := int(rmnRemoteCfg.FSign)
signers := rmnRemoteCfg.Signers
requestIDs, signersRequested, err := c.sendReportSignatureRequest(
reportSigReq,
Expand Down
10 changes: 5 additions & 5 deletions commit/merkleroot/rmn/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ func TestClient_ComputeReportSignatures(t *testing.T) {
rmnRemoteCfg := rmntypes.RemoteConfig{
ContractAddress: []byte{1, 2, 3},
ConfigDigest: cciptypes.Bytes32{0x1, 0x2, 0x3},
F: 2,
FSign: 2,
Signers: []rmntypes.RemoteSignerInfo{
{
OnchainPublicKey: []byte{1, 2, 3},
Expand Down Expand Up @@ -526,7 +526,7 @@ func TestClient_ComputeReportSignatures(t *testing.T) {

requestIDs = ts.waitForReportSignatureRequestsToBeSent(
t, ts.peerClient,
int(ts.remoteRMNCfg.F)+1,
int(ts.remoteRMNCfg.FSign)+1,
ts.homeF,
)

Expand All @@ -541,7 +541,7 @@ func TestClient_ComputeReportSignatures(t *testing.T) {
)
assert.NoError(t, err)
assert.Len(t, sigs.LaneUpdates, len(ts.updateRequests))
assert.Len(t, sigs.Signatures, int(ts.remoteRMNCfg.F+1))
assert.Len(t, sigs.Signatures, int(ts.remoteRMNCfg.FSign+1))
// Make sure signature are in ascending signer address order
for i := 1; i < len(sigs.Signatures); i++ {
assert.True(t, sigs.Signatures[i].R[0] > sigs.Signatures[i-1].R[0])
Expand Down Expand Up @@ -582,7 +582,7 @@ func TestClient_ComputeReportSignatures(t *testing.T) {
t.Logf("requestIDs: %v", requestIDs)

// requests should be sent to more than F+1 nodes, since we hit the timer timeout
assert.Greater(t, len(requestIDs), int(ts.remoteRMNCfg.F)+1)
assert.Greater(t, len(requestIDs), int(ts.remoteRMNCfg.FSign)+1)

ts.nodesRespondToTheSignatureRequests(ts.peerClient, requestIDs)
}()
Expand All @@ -595,7 +595,7 @@ func TestClient_ComputeReportSignatures(t *testing.T) {
)
assert.NoError(t, err)
assert.Len(t, sigs.LaneUpdates, len(ts.updateRequests))
assert.Len(t, sigs.Signatures, int(ts.remoteRMNCfg.F+1))
assert.Len(t, sigs.Signatures, int(ts.remoteRMNCfg.FSign+1))
})
}

Expand Down
4 changes: 2 additions & 2 deletions commit/merkleroot/rmn/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type RemoteConfig struct {
ConfigDigest cciptypes.Bytes32 `json:"configDigest"`
Signers []RemoteSignerInfo `json:"signers"`
// F defines the max number of faulty RMN nodes; F+1 signers are required to verify a report.
F uint64 `json:"f"` // previously: MinSigners
FSign uint64 `json:"fSign"` // previously: MinSigners
ConfigVersion uint32 `json:"configVersion"`
RmnReportVersion cciptypes.Bytes32 `json:"rmnReportVersion"` // e.g., keccak256("RMN_V1_6_ANY2EVM_REPORT")
}
Expand All @@ -44,7 +44,7 @@ func (r RemoteConfig) IsEmpty() bool {
return len(r.ContractAddress) == 0 &&
r.ConfigDigest == (cciptypes.Bytes32{}) &&
len(r.Signers) == 0 &&
r.F == 0 &&
r.FSign == 0 &&
r.ConfigVersion == 0 &&
r.RmnReportVersion == (cciptypes.Bytes32{})
}
Expand Down
8 changes: 4 additions & 4 deletions commit/merkleroot/rmn/types/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestRMNRemoteConfig_IsEmpty(t *testing.T) {
{
name: "Config with only F",
config: RemoteConfig{
F: 1,
FSign: 1,
},
expected: false,
},
Expand All @@ -67,7 +67,7 @@ func TestRMNRemoteConfig_IsEmpty(t *testing.T) {
ContractAddress: cciptypes.UnknownAddress{1, 2, 3},
ConfigDigest: cciptypes.Bytes32{1},
Signers: []RemoteSignerInfo{{}, {}},
F: 2,
FSign: 2,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{1},
},
Expand All @@ -79,7 +79,7 @@ func TestRMNRemoteConfig_IsEmpty(t *testing.T) {
ContractAddress: nil,
ConfigDigest: cciptypes.Bytes32{1},
Signers: []RemoteSignerInfo{{}, {}},
F: 2,
FSign: 2,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{1},
},
Expand All @@ -91,7 +91,7 @@ func TestRMNRemoteConfig_IsEmpty(t *testing.T) {
ContractAddress: cciptypes.UnknownAddress{},
ConfigDigest: cciptypes.Bytes32{1},
Signers: []RemoteSignerInfo{{}, {}},
F: 2,
FSign: 2,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{1},
},
Expand Down
2 changes: 1 addition & 1 deletion commit/merkleroot/validate_observation.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func validateRMNRemoteConfig(
return fmt.Errorf("empty RmnReportVersion")
}

if uint64(len(rmnRemoteConfig.Signers)) < rmnRemoteConfig.F+1 {
if uint64(len(rmnRemoteConfig.Signers)) < rmnRemoteConfig.FSign+1 {
return fmt.Errorf("not enough signers to cover F+1 threshold")
}

Expand Down
16 changes: 8 additions & 8 deletions commit/merkleroot/validate_observation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -215,7 +215,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -233,7 +233,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -251,7 +251,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -267,7 +267,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
Signers: []types.RemoteSignerInfo{
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1}, // <----
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -285,7 +285,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{},
},
Expand All @@ -303,7 +303,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 1}, // <---------
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand All @@ -321,7 +321,7 @@ func Test_validateRMNRemoteConfig(t *testing.T) {
{OnchainPublicKey: []byte{0, 0, 2}, NodeIndex: 1},
{OnchainPublicKey: []byte{0, 0, 3}, NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: 1,
RmnReportVersion: cciptypes.Bytes32{0, 0, 0, 1},
},
Expand Down
2 changes: 1 addition & 1 deletion commit/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (p *Plugin) Reports(
}

if outcome.MerkleRootOutcome.OutcomeType == merkleroot.ReportGenerated {
repInfo = ReportInfo{RemoteF: outcome.MerkleRootOutcome.RMNRemoteCfg.F}
repInfo = ReportInfo{RemoteF: outcome.MerkleRootOutcome.RMNRemoteCfg.FSign}
}

if rep.IsEmpty() {
Expand Down
2 changes: 1 addition & 1 deletion commit/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestPluginReports(t *testing.T) {
MerkleRoot: ccipocr3.Bytes32{1, 2, 3, 4, 5, 6},
},
},
RMNRemoteCfg: rmntypes.RemoteConfig{F: 123},
RMNRemoteCfg: rmntypes.RemoteConfig{FSign: 123},
},
TokenPriceOutcome: tokenprice.Outcome{
TokenPrices: []ccipocr3.TokenPrice{
Expand Down
2 changes: 1 addition & 1 deletion internal/libs/testhelpers/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func CreateRMNRemoteCfg() rmntypes.RemoteConfig {
{OnchainPublicKey: append(rand.RandomBytes(20), byte(1)), NodeIndex: 1},
{OnchainPublicKey: append(rand.RandomBytes(20), byte(2)), NodeIndex: 2},
},
F: 1,
FSign: 1,
ConfigVersion: rand.RandomUint32(),
RmnReportVersion: rand.RandomReportVersion(),
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/reader/ccip.go
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ func (r *ccipChainReader) GetRMNRemoteConfig(
ContractAddress: rmnRemoteAddress,
ConfigDigest: cciptypes.Bytes32(vc.Config.RMNHomeContractConfigDigest),
Signers: signers,
F: vc.Config.F,
FSign: vc.Config.F,
ConfigVersion: vc.Version,
RmnReportVersion: header.DigestHeader,
}, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/reader/rmn_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ type Node struct {
// SourceChain mirrors RMNHome.sol's SourceChain struct
type SourceChain struct {
ChainSelector cciptypes.ChainSelector `json:"chainSelector"`
FObserve uint64 `json:"f"` // previously: MinObservers
FObserve uint64 `json:"fObserve"` // previously: MinObservers / F
ObserverNodesBitmap *big.Int `json:"observerNodesBitmap"`
}

Expand Down

0 comments on commit be53eab

Please sign in to comment.