forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move EVM config ocr and ocr2 (smartcontractkit#9606)
- Loading branch information
1 parent
82ed1c0
commit 97071fb
Showing
15 changed files
with
139 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package v2 | ||
|
||
import "time" | ||
|
||
type ocrConfig struct { | ||
c OCR | ||
} | ||
|
||
func (o *ocrConfig) ContractConfirmations() uint16 { | ||
return *o.c.ContractConfirmations | ||
} | ||
|
||
func (o *ocrConfig) ContractTransmitterTransmitTimeout() time.Duration { | ||
return o.c.ContractTransmitterTransmitTimeout.Duration() | ||
} | ||
|
||
func (o *ocrConfig) ObservationGracePeriod() time.Duration { | ||
return o.c.ObservationGracePeriod.Duration() | ||
} | ||
|
||
func (o *ocrConfig) DatabaseTimeout() time.Duration { | ||
return o.c.DatabaseTimeout.Duration() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package v2 | ||
|
||
import "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config" | ||
|
||
type ocr2Automation struct { | ||
c Automation | ||
} | ||
|
||
func (o *ocr2Automation) GasLimit() uint32 { | ||
return *o.c.GasLimit | ||
} | ||
|
||
type ocr2Config struct { | ||
c OCR2 | ||
} | ||
|
||
func (o *ocr2Config) Automation() config.OCR2Automation { | ||
return &ocr2Automation{c: o.c.Automation} | ||
} | ||
|
||
func (o *ocr2Config) ContractConfirmations() uint16 { | ||
return uint16(*o.c.Automation.GasLimit) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package v2_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest" | ||
) | ||
|
||
func Test_ocr2Config(t *testing.T) { | ||
evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values | ||
require.Equal(t, uint32(5300000), evmOcrCfg.EVM().OCR2().Automation().GasLimit()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package v2_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest" | ||
) | ||
|
||
func Test_ocrConfig(t *testing.T) { | ||
evmOcrCfg := cltest.NewTestChainScopedConfig(t) //fallback.toml values | ||
require.Equal(t, uint16(4), evmOcrCfg.EVM().OCR().ContractConfirmations()) | ||
require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().ContractTransmitterTransmitTimeout()) | ||
require.Equal(t, cltest.MustParseDuration(t, "10s"), evmOcrCfg.EVM().OCR().DatabaseTimeout()) | ||
require.Equal(t, cltest.MustParseDuration(t, "1s"), evmOcrCfg.EVM().OCR().ObservationGracePeriod()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.