Skip to content

Commit

Permalink
bump libocr and update affected areas (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored May 25, 2023
1 parent 837a920 commit 20bed74
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 32 deletions.
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ require (
github.com/pelletier/go-toml v1.9.5
github.com/prometheus/client_golang v1.14.0
github.com/shopspring/decimal v1.3.1
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230418142941-22572bf2b14a
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8
github.com/stretchr/testify v1.8.1
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230525161650-dce1bc58b504
github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3
github.com/stretchr/testify v1.8.2
github.com/tendermint/tendermint v0.34.23
go.uber.org/multierr v1.8.0
go.uber.org/ratelimit v0.2.0
go.uber.org/zap v1.23.0
go.uber.org/zap v1.24.0
golang.org/x/crypto v0.1.0
google.golang.org/genproto v0.0.0-20230223222841-637eb2293923
google.golang.org/grpc v1.53.0
Expand Down Expand Up @@ -118,7 +118,6 @@ require (
github.com/rs/zerolog v1.28.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 // indirect
github.com/sasha-s/go-deadlock v0.3.1 // indirect
github.com/satori/go.uuid v1.2.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
Expand All @@ -140,7 +139,7 @@ require (
go.etcd.io/bbolt v1.3.6 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.0 // indirect
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
Expand Down
22 changes: 10 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -542,19 +542,17 @@ github.com/santhosh-tekuri/jsonschema/v5 v5.1.1 h1:lEOLY2vyGIqKWUI9nzsOJRV3mb3WC
github.com/santhosh-tekuri/jsonschema/v5 v5.1.1/go.mod h1:FKdcjfQW6rpZSnxxUvEA5H/cDPdvJ/SZJQLWWXWGrZ0=
github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0=
github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=
github.com/shirou/gopsutil v3.21.11+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230418142941-22572bf2b14a h1:dSxZz/tJU4wMHf8g/z6DUtK3sFdoi+tYY2NqyhkZJv4=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230418142941-22572bf2b14a/go.mod h1:HvRlco+laJ7MmlmLLabLk8h6uoW4h3JhKGBU+Xg9ivU=
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8 h1:KcTNxuP5g3GGUqn3WJe7KKnTixqfVZjmHnMAnKkLGJw=
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230525161650-dce1bc58b504 h1:LQB12lOqT0Kg6s9zq/zDF5egSPXi7Hyar3QBmjkD32w=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230525161650-dce1bc58b504/go.mod h1:zfUba6Okm7zTBxap24I78Vq9z+twHmjXSMBAl2C2Qgc=
github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3 h1:/Gel/U5eIZ/BGGr25OrHaXiVDTAJ5DYX5+UlXp3q7Gg=
github.com/smartcontractkit/libocr v0.0.0-20230525150148-a75f6e244bb3/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
Expand Down Expand Up @@ -592,8 +590,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
github.com/stretchr/testify v1.7.5/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI=
Expand Down Expand Up @@ -645,8 +643,8 @@ go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95a
go.uber.org/ratelimit v0.2.0 h1:UQE2Bgi7p2B85uP5dC2bbRtig0C+OeNRnNEafLjsLPA=
go.uber.org/ratelimit v0.2.0/go.mod h1:YYBV4e4naJvhpitQrWJu1vCpgB7CboMe0qhltKt6mUg=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
Expand All @@ -673,8 +671,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
11 changes: 8 additions & 3 deletions pkg/cosmos/adapters/cosmwasm/config_digester.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,18 @@ func (cd OffchainConfigDigester) ConfigDigest(cfg types.ContractConfig) (types.C
return digest, fmt.Errorf("incorrect hash size %d, expected %d", n, len(digest))
}

pre, err := cd.ConfigDigestPrefix()
if err != nil {
return digest, err
}

digest[0] = 0x00
digest[1] = uint8(cd.ConfigDigestPrefix())
digest[1] = uint8(pre)

return digest, nil
}

// This should return the same constant value on every invocation
func (OffchainConfigDigester) ConfigDigestPrefix() types.ConfigDigestPrefix {
return ConfigDigestPrefixCosmos
func (OffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) {
return ConfigDigestPrefixCosmos, nil
}
4 changes: 2 additions & 2 deletions pkg/cosmos/adapters/cosmwasm/contract_transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ func (ct *ContractTransmitter) Transmit(
return err
}

func (ct *ContractTransmitter) FromAccount() types.Account {
return types.Account(ct.sender.String())
func (ct *ContractTransmitter) FromAccount() (types.Account, error) {
return types.Account(ct.sender.String()), nil
}
4 changes: 2 additions & 2 deletions pkg/cosmos/adapters/cosmwasm/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ func (c ReportCodec) BuildReport(oo []median.ParsedAttributedObservation) (types
return report, nil
}

func (c ReportCodec) MaxReportLength(n int) int {
return prefixSizeBytes + (n * observationSizeBytes) + juelsPerFeeCoinSizeBytes
func (c ReportCodec) MaxReportLength(n int) (int, error) {
return prefixSizeBytes + (n * observationSizeBytes) + juelsPerFeeCoinSizeBytes, nil
}

func (c ReportCodec) MedianFromReport(report types.Report) (*big.Int, error) {
Expand Down
4 changes: 3 additions & 1 deletion pkg/cosmos/adapters/cosmwasm/report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@ func TestMedianFromReport(t *testing.T) {
}
report, err := cdc.BuildReport(pos)
require.NoError(t, err)
assert.Equal(t, len(report), cdc.MaxReportLength(len(tc.obs)))
max, err := cdc.MaxReportLength(len(tc.obs))
require.NoError(t, err)
assert.Equal(t, len(report), max)
med, err := cdc.MedianFromReport(report)
require.NoError(t, err)
assert.Equal(t, tc.expectedMedian.String(), med.String())
Expand Down
4 changes: 2 additions & 2 deletions pkg/cosmos/adapters/injective/median_report/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ func (ReportCodec) BuildReport(observations []median.ParsedAttributedObservation
return types.Report(reportBytes), err
}

func (ReportCodec) MaxReportLength(n int) int {
func (ReportCodec) MaxReportLength(n int) (int, error) {
// TODO:
return 0
return 0, nil
// return prefixSizeBytes + (n * observationSizeBytes) + juelsPerFeeCoinSizeBytes
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cosmos/adapters/injective/offchain_config_digester.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func (d CosmosOffchainConfigDigester) ConfigDigest(cc types.ContractConfig) (typ
return configDigest, nil
}

func (d CosmosOffchainConfigDigester) ConfigDigestPrefix() types.ConfigDigestPrefix {
return ConfigDigestPrefixCosmos
func (d CosmosOffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) {
return ConfigDigestPrefixCosmos, nil
}

func configDigestFromBytes(buf []byte) types.ConfigDigest {
Expand Down
4 changes: 2 additions & 2 deletions pkg/cosmos/adapters/injective/transmitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ func NewCosmosModuleTransmitter(
}
}

func (c *CosmosModuleTransmitter) FromAccount() types.Account {
return types.Account(c.sender.String())
func (c *CosmosModuleTransmitter) FromAccount() (types.Account, error) {
return types.Account(c.sender.String()), nil
}

// Transmit sends the report to the on-chain OCR2Aggregator smart contract's Transmit method
Expand Down

0 comments on commit 20bed74

Please sign in to comment.