Skip to content

Commit

Permalink
Merge branch 'release/v1.x.x' into chore/backport-757
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 authored Dec 11, 2024
2 parents d719ea9 + f73a9b0 commit eca2ea6
Show file tree
Hide file tree
Showing 51 changed files with 644 additions and 198 deletions.
2 changes: 1 addition & 1 deletion abci/strategies/aggregator/mocks/mock_price_applier.go

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

2 changes: 1 addition & 1 deletion abci/strategies/aggregator/mocks/mock_vote_aggregator.go

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

2 changes: 1 addition & 1 deletion abci/strategies/codec/mocks/extended_commit_codec.go

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

2 changes: 1 addition & 1 deletion abci/strategies/codec/mocks/vote_extension_codec.go

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

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

2 changes: 1 addition & 1 deletion abci/strategies/currencypair/mocks/mock_oracle_keeper.go

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

2 changes: 1 addition & 1 deletion abci/types/mocks/mock_oracle_keeper.go

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

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.10.0
github.com/vektra/mockery/v2 v2.46.0
github.com/vektra/mockery/v2 v2.50.0
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0
golang.org/x/net v0.32.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1428,8 +1428,8 @@ github.com/uudashr/iface v1.2.1 h1:vHHyzAUmWZ64Olq6NZT3vg/z1Ws56kyPdBOd5kTXDF8=
github.com/uudashr/iface v1.2.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/vektra/mockery/v2 v2.46.0 h1:DKIFj6hAPGwmOYiWfWzdsQtBgU8ozPXo3Bwbmf+Ku80=
github.com/vektra/mockery/v2 v2.46.0/go.mod h1:XNTE9RIu3deGAGQRVjP1VZxGpQNm0YedZx4oDs3prr8=
github.com/vektra/mockery/v2 v2.50.0 h1:0GYRH38nKiRghwUq+0aJXG1sT3yyTYj/J1xQRM8kGzQ=
github.com/vektra/mockery/v2 v2.50.0/go.mod h1:xO2DeYemEPC2tCzIZ+a1tifZ/7Laf/Chxg3vlc+oDsI=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8=
Expand Down
9 changes: 9 additions & 0 deletions oracle/config/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ type APIConfig struct {

// Name is the name of the provider that corresponds to this config.
Name string `json:"name"`

// MaxBlockHeightAge is the oldest an update from an on-chain data source can be without having its
// block height incremented. In the case where a data source has exceeded this limit and the block
// height is not increasing, price reporting will be skipped until the block height increases.
MaxBlockHeightAge time.Duration `json:"maxBlockHeightAge"`
}

// Endpoint holds all data necessary for an API provider to connect to a given endpoint
Expand Down Expand Up @@ -123,5 +128,9 @@ func (c *APIConfig) ValidateBasic() error {
}
}

if c.MaxBlockHeightAge < 0 {
return fmt.Errorf("max_block_height_age cannot be negative")
}

return nil
}
30 changes: 30 additions & 0 deletions oracle/config/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,36 @@ func TestAPIConfig(t *testing.T) {
},
expectedErr: false,
},
{
name: "good config with max_block_height_age",
config: config.APIConfig{
Enabled: true,
Timeout: time.Second,
Interval: time.Second,
ReconnectTimeout: time.Second,
MaxQueries: 1,
Name: "test",
Endpoints: []config.Endpoint{{URL: "http://test.com"}},
BatchSize: 1,
MaxBlockHeightAge: 10 * time.Second,
},
expectedErr: false,
},
{
name: "bad config with negative max_block_height_age",
config: config.APIConfig{
Enabled: true,
Timeout: time.Second,
Interval: time.Second,
ReconnectTimeout: time.Second,
MaxQueries: 1,
Name: "test",
Endpoints: []config.Endpoint{{URL: "http://test.com"}},
BatchSize: 1,
MaxBlockHeightAge: -10 * time.Second,
},
expectedErr: true,
},
{
name: "bad config with invalid endpoint (no url)",
config: config.APIConfig{
Expand Down
6 changes: 3 additions & 3 deletions oracle/metrics/mocks/mock_metrics.go

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

8 changes: 4 additions & 4 deletions oracle/mocks/PriceAggregator.go

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

12 changes: 6 additions & 6 deletions oracle/mocks/mock_oracle.go

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

2 changes: 1 addition & 1 deletion pkg/math/voteweighted/mocks/mock_cc_validator_store.go

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

32 changes: 16 additions & 16 deletions pkg/math/voteweighted/mocks/mock_validator.go

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

2 changes: 1 addition & 1 deletion pkg/math/voteweighted/mocks/mock_validator_store.go

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

2 changes: 1 addition & 1 deletion providers/apis/defi/ethmulticlient/mocks/EVMClient.go

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

Loading

0 comments on commit eca2ea6

Please sign in to comment.