Skip to content

Commit

Permalink
Matched G++ Configs
Browse files Browse the repository at this point in the history
  • Loading branch information
chray-zhang committed Dec 6, 2024
1 parent d445bea commit 186d6be
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
15 changes: 1 addition & 14 deletions integration-tests/common/gauntlet_plus_plus_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,7 @@ func (m *OCRv2TestState) fundNodesWithGPP() ([]string, error) {
}

func (m *OCRv2TestState) deployAccessControllerWithGpp() error {
err := m.Clients.GauntletClient.InstallDependencies()
if err != nil {
return err
}
err = m.Clients.GauntletPPClient.DeclareAccessControllerContract()
err := m.Clients.GauntletPPClient.DeclareAccessControllerContract()
if err != nil {
return err
}
Expand All @@ -81,15 +77,6 @@ func (m *OCRv2TestState) deployAccessControllerWithGpp() error {
return nil
}

func (m *OCRv2TestState) declareLinkToken() error {
err := m.Clients.GauntletPPClient.DeclareLinkTokenContract()
if err != nil {
return err
}

return nil
}

func (m *OCRv2TestState) deployLinkTokenWithGpp() error {
var err error
m.Contracts.LinkTokenAddr, err = m.Clients.GauntletPPClient.DeployLinkTokenContract(m.Account.Account)
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ func (m *OCRv2TestState) LoadOCR2Config() (*ops.OCR2Config, error) {
var cfgKeys []string
for i, key := range m.Clients.ChainlinkClient.NKeys {
// need to remove the prefix since legacy gauntlet did it pre op
// https://github.com/smartcontractkit/chainlink-starknet/blob/develop/packages-ts/starknet-gauntlet-ocr2/src/commands/ocr2/setConfig.ts#L124
offChaiNKeys = append(offChaiNKeys, m.removeOCR2PrefixAndAddPrefix(key.OCR2Key.Data.Attributes.OffChainPublicKey, "ocr2off_starknet_", ""))
// In G++ only signers have prefix removed
// https://github.com/smartcontractkit/gauntlet-plus-plus/blob/main/packages-starknet/operations-data-feeds/tests/fixtures/offchain-config.fixture.ts
offChaiNKeys = append(offChaiNKeys, key.OCR2Key.Data.Attributes.OffChainPublicKey)
peerIDs = append(peerIDs, key.PeerID)
txKeys = append(txKeys, m.Clients.ChainlinkClient.AccountAddresses[i])
onChaiNKeys = append(onChaiNKeys, m.removeOCR2PrefixAndAddPrefix(key.OCR2Key.Data.Attributes.OnChainPublicKey, "ocr2on_starknet_", "0x"))
Expand All @@ -287,7 +288,6 @@ func (m *OCRv2TestState) LoadOCR2Config() (*ops.OCR2Config, error) {
}

func (m *OCRv2TestState) removeOCR2PrefixAndAddPrefix(k string, prefix string, newPrefix string) string {
// Print k for debugging before the modification
if strings.HasPrefix(k, prefix) {
return newPrefix + k[len(prefix):]
}
Expand Down
47 changes: 27 additions & 20 deletions ops/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,41 +32,48 @@ type OffchainConfig struct {
}

type ReportingPluginConfig struct {
AlphaReportInfinite bool `json:"alphaReportInfinite"`
AlphaReportPpb int `json:"alphaReportPpb"`
AlphaAcceptInfinite bool `json:"alphaAcceptInfinite"`
AlphaAcceptPpb int `json:"alphaAcceptPpb"`
DeltaCNanoseconds int `json:"deltaCNanoseconds"`
SourceFinalityDepth int `json:"sourceFinalityDepth"`
DestFinalityDepth int `json:"destFinalityDepth"`
MaxGasPrice string `json:"maxGasPrice"`
RelativeBoostPerWaitHour string `json:"relativeBoostPerWaitHour"`
InflightCacheExpiry string `json:"inflightCacheExpiry"`
RootSnoozeTime string `json:"rootSnoozeTime"`
DestOptimisticConfirmations int `json:"DestOptimisticConfirmations"`
BatchGasLimit int `json:"batchGasLimit"`
}

var TestOCR2Config = OCR2Config{
F: 1,
// Signers: onChainKeys, // user defined
// Transmitters: txKeys, // user defined
OnchainConfig: "",
// https://github.com/smartcontractkit/gauntlet-plus-plus/blob/main/packages-starknet/operations-data-feeds/tests/fixtures/offchain-config.fixture.ts
OffchainConfig: &OffchainConfig{
// todo: increase delta round but decrease delta stage
DeltaProgress: "120s", // 120s
DeltaResend: "150s", // 150s
DeltaRound: "90s", // 90s
DeltaGrace: "5s", // 5s
DeltaStage: "20s", // 20s
DeltaProgress: "120000000000ns", // 120s
DeltaResend: "5000000000ns", // 150s
DeltaRound: "60000000000ns", // 90s
DeltaGrace: "5000000000ns", // 5s
DeltaStage: "180000000000ns", // 20s
RMax: 5,
S: []int{1, 1}, // Needs to array with length of transmitting nodes
// OffchainPublicKeys: offChainKeys, // user defined
// PeerIDs: peerIds, // user defined
ReportingPluginConfig: &ReportingPluginConfig{
AlphaReportInfinite: false,
AlphaReportPpb: 0,
AlphaAcceptInfinite: false,
AlphaAcceptPpb: 0,
DeltaCNanoseconds: 1000000000,
SourceFinalityDepth: 5,
DestFinalityDepth: 15,
MaxGasPrice: "300000000000",
RelativeBoostPerWaitHour: "300000000000",
InflightCacheExpiry: "3m0s",
RootSnoozeTime: "3m0s",
DestOptimisticConfirmations: 1,
BatchGasLimit: 1,
},
MaxDurationQuery: "20s",
MaxDurationObservation: "10s",
MaxDurationReport: "20s",
MaxDurationShouldAcceptFinalizedReport: "20s",
MaxDurationShouldTransmitAcceptedReport: "20s",
MaxDurationQuery: "100000000ns",
MaxDurationObservation: "35000000000ns",
MaxDurationReport: "10000000000ns",
MaxDurationShouldAcceptFinalizedReport: "5000000000ns",
MaxDurationShouldTransmitAcceptedReport: "10000000000ns",
// ConfigPublicKeys: cfgKeys, // user defined
// https://github.com/smartcontractkit/gauntlet-plus-plus/blob/5faf35e1d372e3ae5388c295554aa4f87bc0ece0/packages-starknet/operations-data-feeds/tests/fixtures/offchain-config.fixture.ts#L23
ConfigEncodingSecret: "abandon ability able about above absent absorb abstract absurd abuse access accident",
Expand Down

0 comments on commit 186d6be

Please sign in to comment.