Skip to content
Draft
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: 9 additions & 0 deletions .idea/libocr.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 74 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions gethwrappers2/ocr2abstract/ocr2abstract.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion offchainreporting/internal/managed/track_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func (state *trackConfigState) checkLatestConfigDetails() (
return nil, false
}
if latestConfigDigest == (types.ConfigDigest{}) {
state.logger.Warn("TrackConfig: LatestConfigDetails() returned a zero configDigest. Looks like the contract has not been configured", commontypes.LogFields{
state.logger.Warn("TrackConfig: LatestConfigDetails() returned a zero configDigest, oh poo. Looks like the contract has not been configured", commontypes.LogFields{
"configDigest": latestConfigDigest,
})
return nil, false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func PublicConfigFromContractConfig(skipResourceExhaustionChecks bool, change ty
}

func publicConfigFromContractConfig(skipResourceExhaustionChecks bool, change types.ContractConfig) (PublicConfig, config.SharedSecretEncryptions, error) {
fmt.Printf("OCRDEBUG: publicConfigFromContractConfig: change: %+v\n", change)
fmt.Printf("OCRDEBUG: publicConfigFromContractConfig: change signers: %+v\n", change.Signers)

if change.OffchainConfigVersion != config.OCR3OffchainConfigVersion {
return PublicConfig{}, config.SharedSecretEncryptions{}, fmt.Errorf("unsuppported OffchainConfigVersion %v, supported OffchainConfigVersion is %v", change.OffchainConfigVersion, config.OCR3OffchainConfigVersion)
}
Expand All @@ -148,6 +151,8 @@ func publicConfigFromContractConfig(skipResourceExhaustionChecks bool, change ty
return PublicConfig{}, config.SharedSecretEncryptions{}, err
}

fmt.Printf("OCRDEBUG: publicConfigFromContractConfig: deserialized offchain config: %+v\n", oc)

if err := checkIdentityListsHaveNoDuplicates(change, oc); err != nil {
return PublicConfig{}, config.SharedSecretEncryptions{}, err
}
Expand All @@ -168,6 +173,8 @@ func publicConfigFromContractConfig(skipResourceExhaustionChecks bool, change ty
})
}

fmt.Printf("OCRDEBUG: publicConfigFromContractConfig: identities: %+v\n", identities)

cfg := PublicConfig{
oc.DeltaProgress,
oc.DeltaResend,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,26 @@ func SharedConfigFromContractConfig[RI any](
peerID string,
transmitAccount types.Account,
) (SharedConfig, commontypes.OracleID, error) {
fmt.Printf("SharedConfigFromContractConfig: at the start")

publicConfig, encSharedSecret, err := publicConfigFromContractConfig(skipResourceExhaustionChecks, change)
if err != nil {
return SharedConfig{}, 0, err
}

fmt.Printf("SharedConfigFromContractConfig: publicConfig: %+v\n", publicConfig)

oracleID := commontypes.OracleID(math.MaxUint8)
{
onchainPublicKey := onchainKeyring.PublicKey()
fmt.Printf("SharedConfigFromContractConfig: onchainPublicKey: %x\n", onchainPublicKey)

offchainPublicKey := offchainKeyring.OffchainPublicKey()

fmt.Printf("SharedConfigFromContractConfig: offchainPublicKey: %x\n", offchainPublicKey)
var found bool
for i, identity := range publicConfig.OracleIdentities {
fmt.Printf("Comparing identity %d: %x with onchainPublicKey: %x\n", i, identity.OnchainPublicKey, onchainPublicKey)
if bytes.Equal(identity.OnchainPublicKey, onchainPublicKey) {
if identity.OffchainPublicKey != offchainPublicKey {
return SharedConfig{}, 0, errors.Errorf(
Expand Down Expand Up @@ -99,6 +108,8 @@ func SharedConfigFromContractConfig[RI any](
return SharedConfig{}, 0, fmt.Errorf("could not decrypt shared secret: %w", err)
}

fmt.Printf("returning public config and oracleID: %v, %d\n", publicConfig, oracleID)

return SharedConfig{
publicConfig,
x,
Expand Down
27 changes: 27 additions & 0 deletions offchainreporting2plus/internal/managed/managed_ocr3_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func RunManagedOCR3Oracle[RI any](
subs := subprocesses.Subprocesses{}
defer subs.Wait()

fmt.Print("OCRDEBUG: ManagedOCR3Oracle: RunManagedOCR3Oracle called\n")

var chTelemetrySend chan<- *serialization.TelemetryWrapper
{
chTelemetry := make(chan *serialization.TelemetryWrapper, 100)
Expand All @@ -63,11 +65,15 @@ func RunManagedOCR3Oracle[RI any](
func(ctx context.Context, logger loghelper.LoggerWithContext, contractConfig types.ContractConfig) (err error, retry bool) {
skipResourceExhaustionChecks := localConfig.DevelopmentMode == types.EnableDangerousDevelopmentMode

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: runWithContractConfig called with contractConfig: %+v\n", contractConfig)

fromAccount, err := contractTransmitter.FromAccount(ctx)
if err != nil {
return fmt.Errorf("ManagedOCR3Oracle: error getting FromAccount: %w", err), true
}

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: FromAccount: %s\n", fromAccount)

sharedConfig, oid, err := ocr3config.SharedConfigFromContractConfig(
skipResourceExhaustionChecks,
contractConfig,
Expand All @@ -76,10 +82,15 @@ func RunManagedOCR3Oracle[RI any](
netEndpointFactory.PeerID(),
fromAccount,
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: SharedConfigFromContractConfig returned sharedConfig: %+v, oid: %s\n", sharedConfig, oid)
if err != nil {
fmt.Printf("ManagedOCR3Oracle: error while decoding ContractConfig: %v\n", err)
return fmt.Errorf("ManagedOCR3Oracle: error while decoding ContractConfig: %w", err), false
}

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 0")

registerer := prometheus.WrapRegistererWith(
prometheus.Labels{
// disambiguate different protocol instances by configDigest
Expand All @@ -90,12 +101,14 @@ func RunManagedOCR3Oracle[RI any](
metricsRegistererWrapper,
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 1")
// Run with new config
peerIDs := []string{}
for _, identity := range sharedConfig.OracleIdentities {
peerIDs = append(peerIDs, identity.PeerID)
}

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 2")
childLogger := logger.MakeChild(commontypes.LogFields{
"oid": oid,
})
Expand All @@ -104,6 +117,7 @@ func RunManagedOCR3Oracle[RI any](
initCtx, initCancel := context.WithTimeout(ctx, maxDurationInitialization)
defer initCancel()

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 3")
ins := loghelper.NewIfNotStopped(
maxDurationInitialization+protocol.ReportingPluginTimeoutWarningGracePeriod,
func() {
Expand All @@ -113,6 +127,7 @@ func RunManagedOCR3Oracle[RI any](
},
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 4")
reportingPlugin, reportingPluginInfo, err := reportingPluginFactory.NewReportingPlugin(initCtx, ocr3types.ReportingPluginConfig{
sharedConfig.ConfigDigest,
oid,
Expand All @@ -126,8 +141,10 @@ func RunManagedOCR3Oracle[RI any](
sharedConfig.MaxDurationShouldAcceptAttestedReport,
sharedConfig.MaxDurationShouldTransmitAcceptedReport,
})
fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 5")

ins.Stop()
fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 6")

if err != nil {
return fmt.Errorf("ManagedOCR3Oracle: error during NewReportingPlugin(): %w", err), true
Expand All @@ -138,13 +155,15 @@ func RunManagedOCR3Oracle[RI any](
"ManagedOCR3Oracle: error during reportingPlugin.Close()",
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 7")
if err := validateOCR3ReportingPluginLimits(reportingPluginInfo.Limits); err != nil {
logger.Error("ManagedOCR3Oracle: invalid ReportingPluginInfo", commontypes.LogFields{
"error": err,
"reportingPluginInfo": reportingPluginInfo,
})
return fmt.Errorf("ManagedOCR3Oracle: invalid MercuryPluginInfo"), false
}
fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 8")

maxSigLen := onchainKeyring.MaxSignatureLength()
lims, err := limits.OCR3Limits(sharedConfig.PublicConfig, reportingPluginInfo.Limits, maxSigLen)
Expand All @@ -157,6 +176,7 @@ func RunManagedOCR3Oracle[RI any](
})
return fmt.Errorf("ManagedOCR3Oracle: error during limits"), false
}
fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 9")
binNetEndpoint, err := netEndpointFactory.NewEndpoint(
sharedConfig.ConfigDigest,
peerIDs,
Expand All @@ -173,6 +193,8 @@ func RunManagedOCR3Oracle[RI any](
return fmt.Errorf("ManagedOCR3Oracle: error during NewEndpoint"), true
}

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 10")

// No need to binNetEndpoint.Start/Close since netEndpoint will handle that for us

netEndpoint := shim.NewOCR3SerializingEndpoint[RI](
Expand All @@ -189,12 +211,15 @@ func RunManagedOCR3Oracle[RI any](
if err := netEndpoint.Start(); err != nil {
return fmt.Errorf("ManagedOCR3Oracle: error during netEndpoint.Start(): %w", err), true
}

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 11")
defer loghelper.CloseLogError(
netEndpoint,
logger,
"ManagedOCR3Oracle: error during netEndpoint.Close()",
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 12")
protocol.RunOracle[RI](
ctx,
sharedConfig,
Expand All @@ -211,6 +236,8 @@ func RunManagedOCR3Oracle[RI any](
shim.NewOCR3TelemetrySender(chTelemetrySend, childLogger, localConfig.EnableTransmissionTelemetry),
)

fmt.Printf("OCRDEBUG: ManagedOCR3Oracle: 13")

return nil, false
},
localConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package managed

import (
"context"
"fmt"
"math/rand"
"time"

Expand Down Expand Up @@ -83,6 +84,8 @@ type runWithContractConfigState struct {
}

func (rwcc *runWithContractConfigState) run() {
fmt.Println("OCRDEBUG: runWithContractConfig: run called")

// Restore config from database, so that we can run even if the ethereum node
// isn't working.
rwcc.restoreFromDatabase()
Expand Down
Loading