Skip to content

Commit

Permalink
Base 1 commit
Browse files Browse the repository at this point in the history
  • Loading branch information
raghu0891 committed Nov 26, 2024
1 parent 5404290 commit 677173e
Show file tree
Hide file tree
Showing 31 changed files with 282 additions and 236 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang 1.20
mockery 2.12.1
mockery 2.43.2
2 changes: 1 addition & 1 deletion Automation_Grants.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ Automation-License-grants

Additional Use Grant(s):

You may make use of Plugin Automation (which is available subject to the license here the “Licensed Work”) solely for purposes listed below:
You may make use of plugin Automation (which is available subject to the license here the “Licensed Work”) solely for purposes listed below:
2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

Copyright (c) 2023 SmartContract Plugin Limited SEZC

Portions of this software are licensed as follows:

*All content residing under (1) https://github.com/goplugin/pluginv3.0/tree/develop/contracts/src/v0.8/automation/2_1; (2) https://github.com/goplugin/plugin-automation/tree/main/pkg/v3 are licensed under “Business Source License 1.1” with a Change Date of September 12, 2027 and Change License to “MIT License”
Expand Down
2 changes: 1 addition & 1 deletion docs/PROTOCOL_v21.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ This document aims to give a high level overview of the protocol for Automation

## Abstract

Plugin Automation is a decentralized execution engine for automating smart contracts,
plugin Automation is a decentralized execution engine for automating smart contracts,
with a generic and extensible triggering mechanism.

The protocol is implemented using the OCR3 interface, which is a decentralized consensus framework for off-chain computation.
Expand Down
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.17.0
github.com/shopspring/decimal v1.4.0
github.com/goplugin/plugin-common v0.0.1
github.com/goplugin/plugin-libocr v0.1.1//changes for plugin update
//github.com/goplugin/plugin-common v0.0.1
//github.com/goplugin/plugin-libocr v0.0.0-20241007185508-adbe57025f12
github.com/goplugin/plugin-common v0.0.1
github.com/goplugin/plugin-libocr v0.1.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.27.0
Expand Down Expand Up @@ -73,3 +74,5 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

retract [v1.0.0-0, v1.0.5] // reverting to v0
34 changes: 0 additions & 34 deletions internal/util/closer.go

This file was deleted.

29 changes: 0 additions & 29 deletions internal/util/closer_test.go

This file was deleted.

17 changes: 12 additions & 5 deletions pkg/v2/coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

"github.com/goplugin/plugin-automation/pkg/util"
ocr2keepers "github.com/goplugin/plugin-automation/pkg/v2"
"github.com/goplugin/plugin-common/pkg/services"
)

var (
Expand Down Expand Up @@ -74,7 +75,7 @@ type reportCoordinator struct {

// run state data
running atomic.Bool
chStop chan struct{}
chStop services.StopChan
}

// NewReportCoordinator provides a new report coordinator. The coordinator
Expand Down Expand Up @@ -228,7 +229,7 @@ func (rc *reportCoordinator) checkLogs(ctx context.Context) error {
}
}

staleReportLogs, err = rc.logs.StaleReportLogs(context.Background())
staleReportLogs, err = rc.logs.StaleReportLogs(ctx)
// It can happen that in between the time the report is generated and it gets
// confirmed on chain something changes and it becomes stale. Current scenarios are:
// - Another report for the upkeep is transmitted making this report stale
Expand Down Expand Up @@ -386,13 +387,20 @@ func (rc *reportCoordinator) Close() error {
func (rc *reportCoordinator) run() {
cadence := time.Second
timer := time.NewTimer(cadence)
defer timer.Stop()

ctx, cancel := rc.chStop.NewCtx()
defer cancel()

for {
select {
case <-timer.C:
startTime := time.Now()

if err := rc.checkLogs(context.Background()); err != nil {
if err := rc.checkLogs(ctx); err != nil {
if ctx.Err() != nil {
return
}
rc.logger.Printf("failed to check perform and stale report logs: %s", err)
}

Expand All @@ -407,8 +415,7 @@ func (rc *reportCoordinator) run() {
// wait the difference between the cadence and the time taken
timer.Reset(cadence - diff)
}
case <-rc.chStop:
timer.Stop()
case <-ctx.Done():
return
}
}
Expand Down
23 changes: 17 additions & 6 deletions pkg/v2/coordinator/mocks/encoder.generated.go

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

19 changes: 13 additions & 6 deletions pkg/v2/coordinator/mocks/log_provider.generated.go

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

11 changes: 5 additions & 6 deletions pkg/v2/mocks/logger.generated.go

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

2 changes: 0 additions & 2 deletions pkg/v3/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.

Parameters

Licensor: SmartContract Plugin Limited SEZC

Licensed Work: Automation v2.1
The Licensed Work is (c) 2023 SmartContract Plugin Limited SEZC

Additional Use Grant: Any uses listed and defined at https://github.com/goplugin/plugin-automation/tree/main/pkg/v3/Automation_v2.1_Grants.md

Expand Down
Loading

0 comments on commit 677173e

Please sign in to comment.