From b7ac70407ac589fa66f15bed10d35ec3db6b9820 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 12 Jan 2024 17:18:55 -0600 Subject: [PATCH] bump libocr; add context --- go.mod | 22 ++++----- go.sum | 44 +++++++++--------- integration-tests/go.mod | 29 ++++++------ integration-tests/solclient/ocr2.go | 6 ++- pkg/monitoring/source_envelope.go | 2 +- pkg/solana/cmd/chainlink-solana/main.go | 2 +- pkg/solana/config_digester.go | 7 +-- pkg/solana/config_digester_test.go | 6 ++- pkg/solana/config_tracker.go | 6 +-- pkg/solana/monitor/balance.go | 4 +- pkg/solana/relay.go | 60 +++++++++++++++---------- pkg/solana/report.go | 7 +-- pkg/solana/report_fuzz_test.go | 9 ++-- pkg/solana/report_test.go | 25 ++++++----- pkg/solana/transmitter.go | 2 +- pkg/solana/txm/txm.go | 42 +++++++---------- 16 files changed, 146 insertions(+), 127 deletions(-) diff --git a/go.mod b/go.mod index cb7a616c0..03bea0cdc 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/smartcontractkit/chainlink-solana -go 1.22 +go 1.22.0 -toolchain go1.22.3 +toolchain go1.22.5 require ( github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -17,13 +17,13 @@ require ( github.com/jpillora/backoff v1.0.0 github.com/pelletier/go-toml/v2 v2.2.0 github.com/prometheus/client_golang v1.17.0 - github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886 - github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926121514-3e35d06a0e47 + github.com/smartcontractkit/libocr v0.0.0-20240924101345-0a5d01f8b599 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 - golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa + golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 golang.org/x/sync v0.8.0 - golang.org/x/text v0.17.0 + golang.org/x/text v0.18.0 ) require ( @@ -40,7 +40,7 @@ require ( github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/confluentinc/confluent-kafka-go/v2 v2.3.0 // indirect github.com/dfuse-io/logging v0.0.0-20210109005628-b97a57253f70 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.17.0 // indirect github.com/fxamacker/cbor/v2 v2.5.0 // indirect github.com/go-json-experiment/json v0.0.0-20231102232822-2e55bd4e08b0 // indirect github.com/go-logr/logr v1.4.2 // indirect @@ -117,10 +117,10 @@ require ( go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect - golang.org/x/crypto v0.26.0 // indirect - golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.23.0 // indirect + golang.org/x/crypto v0.27.0 // indirect + golang.org/x/net v0.29.0 // indirect + golang.org/x/sys v0.25.0 // indirect + golang.org/x/term v0.24.0 // indirect golang.org/x/time v0.3.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20240822170219-fc7c04adadcd // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect diff --git a/go.sum b/go.sum index d1163d17c..a2103df28 100644 --- a/go.sum +++ b/go.sum @@ -121,8 +121,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= +github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= @@ -435,12 +435,12 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886 h1:69C4DkuBLomL5mO4pt82B4zjv+ruT76LZdfXiVK08lg= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886/go.mod h1:sjiiPwd4KsYOCf68MwL86EKphdXeT66EY7j53WH5DCc= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926121514-3e35d06a0e47 h1:fLsS7b5ChmQxHnZBHbSdoExhbv1Mnnn7/S8pxgfY/IE= +github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926121514-3e35d06a0e47/go.mod h1:v/ecS0T41eOKXrTRoaZnk0hra4tcx5/q4/9cGHfJzzU= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= -github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e h1:9ypZ/8aW8Vm497i1gXHcT96oNLiu88jbg9QdX+IUE3E= -github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= +github.com/smartcontractkit/libocr v0.0.0-20240924101345-0a5d01f8b599 h1:I8CbQDRJOUjQjL/i8naAmWWNSVb+ln6N0zB6bA85598= +github.com/smartcontractkit/libocr v0.0.0-20240924101345-0a5d01f8b599/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -583,8 +583,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= -golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= +golang.org/x/crypto v0.27.0 h1:GXm2NjJrPaiv/h1tb2UH8QfgC/hOf/+z0p6PT8o1w7A= +golang.org/x/crypto v0.27.0/go.mod h1:1Xngt8kV6Dvbssa53Ziq6Eqn0HqbZi5Z6R0ZpwQzt70= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -595,8 +595,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-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= -golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= 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= @@ -619,8 +619,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0= -golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= +golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -651,8 +651,8 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= -golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= +golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo= +golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -717,13 +717,13 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= -golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= +golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM= +golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -732,8 +732,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -778,8 +778,8 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= -golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24= -golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ= +golang.org/x/tools v0.25.0 h1:oFU9pkj/iJgs+0DT+VMHrx+oBKs/LJMV+Uvg78sl+fE= +golang.org/x/tools v0.25.0/go.mod h1:/vtpO8WL1N9cQC3FN5zPqb//fRXskFHbLKk4OW1Q7rg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 513c57483..f457341ed 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -14,13 +14,13 @@ require ( github.com/lib/pq v1.10.9 github.com/pelletier/go-toml/v2 v2.2.2 github.com/rs/zerolog v1.33.0 - github.com/smartcontractkit/chainlink-common v0.2.3-0.20240919092417-53e784c2e420 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664 - github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.9 + github.com/smartcontractkit/chainlink-common v0.2.3-0.20240926121514-3e35d06a0e47 + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240912124536-8a5001acbdf6 + github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240924233109-8b37da54ea01 - github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240924233109-8b37da54ea01 - github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 + github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240912145327-32d92cce043b + github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240912145327-32d92cce043b + github.com/smartcontractkit/libocr v0.0.0-20240924101345-0a5d01f8b599 github.com/stretchr/testify v1.9.0 github.com/testcontainers/testcontainers-go v0.28.0 golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 @@ -40,7 +40,6 @@ require ( filippo.io/edwards25519 v1.1.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/AlekSi/pointer v1.1.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect @@ -377,17 +376,17 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/slack-go/slack v0.12.2 // indirect github.com/smartcontractkit/chain-selectors v1.0.23 // indirect - github.com/smartcontractkit/chainlink-automation v1.0.4 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240924115754-8858b0423283 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect - github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240916152957-433914114bd2 // indirect - github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911194142-506bc469d8ae // indirect + github.com/smartcontractkit/chainlink-automation v1.0.5-0.20240830223112-2458875146a8 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240911121001-cee56f63ef9c // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240912122911-5ba41b05509d // indirect + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240909212503-65c2f9dadebb // indirect + github.com/smartcontractkit/chainlink-feeds v0.0.0-20240911113617-2beefde2239c // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240912124313-7ad5cb2e1176 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect - github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect - github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect + github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20240911115935-ab7ffac22a35 // indirect + github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20240911115935-ab7ffac22a35 // indirect github.com/smartcontractkit/wsrpc v0.8.2 // indirect github.com/soheilhy/cmux v0.1.5 // indirect github.com/sony/gobreaker v0.5.0 // indirect diff --git a/integration-tests/solclient/ocr2.go b/integration-tests/solclient/ocr2.go index 3fdbdd473..0c84609c6 100644 --- a/integration-tests/solclient/ocr2.go +++ b/integration-tests/solclient/ocr2.go @@ -10,10 +10,11 @@ import ( "github.com/gagliardetto/solana-go" "github.com/gagliardetto/solana-go/rpc" "github.com/rs/zerolog/log" - "github.com/smartcontractkit/chainlink/integration-tests/contracts" "github.com/smartcontractkit/libocr/offchainreporting2/confighelper" - ocr_2 "github.com/smartcontractkit/chainlink-solana/contracts/generated/ocr_2" + "github.com/smartcontractkit/chainlink/integration-tests/contracts" + + "github.com/smartcontractkit/chainlink-solana/contracts/generated/ocr_2" "github.com/smartcontractkit/chainlink-solana/integration-tests/utils" ) @@ -254,6 +255,7 @@ func (m *OCRv2) Configure(cfg contracts.OffChainAggregatorV2Config) error { cfg.S, cfg.Oracles, cfg.ReportingPluginConfig, + nil, cfg.MaxDurationQuery.Duration(), cfg.MaxDurationObservation.Duration(), cfg.MaxDurationReport.Duration(), diff --git a/pkg/monitoring/source_envelope.go b/pkg/monitoring/source_envelope.go index 8b0850ed6..94bce56a0 100644 --- a/pkg/monitoring/source_envelope.go +++ b/pkg/monitoring/source_envelope.go @@ -83,7 +83,7 @@ func (s *envelopeSource) Fetch(ctx context.Context) (interface{}, error) { if err != nil { return nil, fmt.Errorf("failed to fetch state from on-chain: %w", err) } - contractConfig, err := pkgSolana.ConfigFromState(state) + contractConfig, err := pkgSolana.ConfigFromState(ctx, state) if err != nil { return nil, fmt.Errorf("failed to decode ContractConfig from on-chain state: %w", err) } diff --git a/pkg/solana/cmd/chainlink-solana/main.go b/pkg/solana/cmd/chainlink-solana/main.go index d65f6cbc9..09656cf87 100644 --- a/pkg/solana/cmd/chainlink-solana/main.go +++ b/pkg/solana/cmd/chainlink-solana/main.go @@ -72,7 +72,7 @@ func (c *pluginRelayer) NewRelayer(ctx context.Context, config string, keystore return nil, fmt.Errorf("failed to create chain: %w", err) } - ra := &loop.RelayerAdapter{Relayer: solana.NewRelayer(c.Logger, chain, capRegistry), RelayerExt: chain} + ra := solana.NewRelayer(c.Logger, chain, capRegistry) c.SubService(ra) diff --git a/pkg/solana/config_digester.go b/pkg/solana/config_digester.go index 17c70e04a..b1753e79f 100644 --- a/pkg/solana/config_digester.go +++ b/pkg/solana/config_digester.go @@ -1,6 +1,7 @@ package solana import ( + "context" "crypto/sha256" "encoding/binary" "fmt" @@ -20,7 +21,7 @@ type OffchainConfigDigester struct { } // ConfigDigest is meant to do the same thing as config_digest_from_data from the program. -func (d OffchainConfigDigester) ConfigDigest(cfg types.ContractConfig) (types.ConfigDigest, error) { +func (d OffchainConfigDigester) ConfigDigest(ctx context.Context, cfg types.ContractConfig) (types.ConfigDigest, error) { digest := types.ConfigDigest{} buf := sha256.New() @@ -85,7 +86,7 @@ func (d OffchainConfigDigester) ConfigDigest(cfg types.ContractConfig) (types.Co return digest, fmt.Errorf("incorrect hash size %d, expected %d", n, len(digest)) } - pre, err := d.ConfigDigestPrefix() + pre, err := d.ConfigDigestPrefix(ctx) if err != nil { return digest, err } @@ -95,6 +96,6 @@ func (d OffchainConfigDigester) ConfigDigest(cfg types.ContractConfig) (types.Co } // This should return the same constant value on every invocation -func (OffchainConfigDigester) ConfigDigestPrefix() (types.ConfigDigestPrefix, error) { +func (OffchainConfigDigester) ConfigDigestPrefix(ctx context.Context) (types.ConfigDigestPrefix, error) { return types.ConfigDigestPrefixSolana, nil } diff --git a/pkg/solana/config_digester_test.go b/pkg/solana/config_digester_test.go index 9719d627b..eaab12003 100644 --- a/pkg/solana/config_digester_test.go +++ b/pkg/solana/config_digester_test.go @@ -6,6 +6,8 @@ import ( bin "github.com/gagliardetto/binary" "github.com/gagliardetto/solana-go" "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestConfigDigester(t *testing.T) { @@ -22,10 +24,10 @@ func TestConfigDigester(t *testing.T) { var state State err = bin.NewBorshDecoder(mockState.Raw).Decode(&state) require.NoError(t, err) - config, err := ConfigFromState(state) + config, err := ConfigFromState(tests.Context(t), state) require.NoError(t, err) - actualDigest, err := digester.ConfigDigest(config) + actualDigest, err := digester.ConfigDigest(tests.Context(t), config) require.NoError(t, err) expectedDigest := mockState.ConfigDigestHex diff --git a/pkg/solana/config_tracker.go b/pkg/solana/config_tracker.go index 3287aa115..a04450edd 100644 --- a/pkg/solana/config_tracker.go +++ b/pkg/solana/config_tracker.go @@ -25,7 +25,7 @@ func (c *ConfigTracker) LatestConfigDetails(ctx context.Context) (changedInBlock return state.Config.LatestConfigBlockNumber, state.Config.LatestConfigDigest, err } -func ConfigFromState(state State) (types.ContractConfig, error) { +func ConfigFromState(ctx context.Context, state State) (types.ContractConfig, error) { pubKeys := []types.OnchainPublicKey{} accounts := []types.Account{} oracles, err := state.Oracles.Data() @@ -43,7 +43,7 @@ func ConfigFromState(state State) (types.ContractConfig, error) { Max: state.Config.MaxAnswer.BigInt(), } - onchainConfig, err := median.StandardOnchainConfigCodec{}.Encode(onchainConfigStruct) + onchainConfig, err := median.StandardOnchainConfigCodec{}.Encode(ctx, onchainConfigStruct) if err != nil { return types.ContractConfig{}, err } @@ -70,7 +70,7 @@ func (c *ConfigTracker) LatestConfig(ctx context.Context, changedInBlock uint64) if err != nil { return types.ContractConfig{}, err } - return ConfigFromState(state) + return ConfigFromState(ctx, state) } // LatestBlockHeight returns the height of the most recent block in the chain. diff --git a/pkg/solana/monitor/balance.go b/pkg/solana/monitor/balance.go index 00f873488..5c7c88f5d 100644 --- a/pkg/solana/monitor/balance.go +++ b/pkg/solana/monitor/balance.go @@ -64,14 +64,14 @@ func (b *balanceMonitor) Name() string { } func (b *balanceMonitor) Start(context.Context) error { - return b.StartOnce("SolanaBalanceMonitor", func() error { + return b.StartOnce("BalanceMonitor", func() error { go b.monitor() return nil }) } func (b *balanceMonitor) Close() error { - return b.StopOnce("SolanaBalanceMonitor", func() error { + return b.StopOnce("BalanceMonitor", func() error { close(b.stop) <-b.done return nil diff --git a/pkg/solana/relay.go b/pkg/solana/relay.go index 9121b185f..7f38cdfff 100644 --- a/pkg/solana/relay.go +++ b/pkg/solana/relay.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "math/big" "github.com/gagliardetto/solana-go" @@ -36,11 +37,11 @@ type Relayer struct { } // Note: constructed in core -func NewRelayer(lggr logger.Logger, chain Chain, capabilitiesRegistry core.CapabilitiesRegistry) *Relayer { +func NewRelayer(lggr logger.Logger, chain Chain, _ core.CapabilitiesRegistry) *Relayer { return &Relayer{ - lggr: lggr, + lggr: logger.Named(lggr, "Relayer"), chain: chain, - stopCh: make(chan struct{}), + stopCh: make(services.StopChan), } } @@ -49,13 +50,13 @@ func (r *Relayer) Name() string { } // Start starts the relayer respecting the given context. -func (r *Relayer) Start(context.Context) error { +func (r *Relayer) Start(ctx context.Context) error { return r.StartOnce("SolanaRelayer", func() error { // No subservices started on relay start, but when the first job is started if r.chain == nil { return errors.New("Solana unavailable") } - return nil + return r.chain.Start(ctx) }) } @@ -63,7 +64,7 @@ func (r *Relayer) Start(context.Context) error { func (r *Relayer) Close() error { return r.StopOnce("SolanaRelayer", func() error { close(r.stopCh) - return nil + return r.chain.Close() }) } @@ -71,32 +72,47 @@ func (r *Relayer) Ready() error { return r.chain.Ready() } -// Healthy only if all subservices are healthy func (r *Relayer) Healthy() error { return nil } func (r *Relayer) HealthReport() map[string]error { - return map[string]error{r.Name(): r.Healthy()} + hp := map[string]error{r.Name(): r.Healthy()} + services.CopyHealth(hp, r.chain.HealthReport()) + return hp } -func (r *Relayer) NewMercuryProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MercuryProvider, error) { +func (r *Relayer) LatestHead(ctx context.Context) (relaytypes.Head, error) { + return r.chain.LatestHead(ctx) +} + +func (r *Relayer) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, error) { + return r.chain.GetChainStatus(ctx) +} + +func (r *Relayer) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []relaytypes.NodeStatus, nextPageToken string, total int, err error) { + return r.chain.ListNodeStatuses(ctx, pageSize, pageToken) +} + +func (r *Relayer) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { + return r.chain.Transact(ctx, from, to, amount, balanceCheck) +} + +func (r *Relayer) NewMercuryProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MercuryProvider, error) { return nil, errors.New("mercury is not supported for solana") } -func (r *Relayer) NewLLOProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.LLOProvider, error) { +func (r *Relayer) NewLLOProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.LLOProvider, error) { return nil, errors.New("data streams is not supported for solana") } -func (r *Relayer) NewCCIPCommitProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.CCIPCommitProvider, error) { +func (r *Relayer) NewCCIPCommitProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.CCIPCommitProvider, error) { return nil, errors.New("ccip.commit is not supported for solana") } -func (r *Relayer) NewCCIPExecProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.CCIPExecProvider, error) { +func (r *Relayer) NewCCIPExecProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.CCIPExecProvider, error) { return nil, errors.New("ccip.exec is not supported for solana") } -func (r *Relayer) NewConfigProvider(args relaytypes.RelayArgs) (relaytypes.ConfigProvider, error) { - ctx, cancel := r.stopCh.NewCtx() - defer cancel() +func (r *Relayer) NewConfigProvider(ctx context.Context, args relaytypes.RelayArgs) (relaytypes.ConfigProvider, error) { configWatcher, err := newConfigProvider(ctx, r.lggr, r.chain, args) if err != nil { // Never return (*configProvider)(nil) @@ -109,13 +125,11 @@ func (r *Relayer) NewChainWriter(_ context.Context, _ []byte) (relaytypes.ChainW return nil, errors.New("chain writer is not supported for solana") } -func (r *Relayer) NewContractReader(_ []byte) (relaytypes.ContractReader, error) { +func (r *Relayer) NewContractReader(ctx context.Context, _ []byte) (relaytypes.ContractReader, error) { return nil, errors.New("contract reader is not supported for solana") } -func (r *Relayer) NewMedianProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MedianProvider, error) { - ctx, cancel := r.stopCh.NewCtx() - defer cancel() +func (r *Relayer) NewMedianProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MedianProvider, error) { lggr := logger.Named(r.lggr, "MedianProvider") configWatcher, err := newConfigProvider(ctx, lggr, r.chain, rargs) if err != nil { @@ -163,11 +177,11 @@ func (r *Relayer) NewMedianProvider(rargs relaytypes.RelayArgs, pargs relaytypes }, nil } -func (r *Relayer) NewFunctionsProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.FunctionsProvider, error) { +func (r *Relayer) NewFunctionsProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.FunctionsProvider, error) { return nil, errors.New("functions are not supported for solana") } -func (r *Relayer) NewAutomationProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.AutomationProvider, error) { +func (r *Relayer) NewAutomationProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.AutomationProvider, error) { return nil, errors.New("automation is not supported for solana") } @@ -312,10 +326,10 @@ func (p *medianProvider) Codec() relaytypes.Codec { return nil } -func (r *Relayer) NewPluginProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.PluginProvider, error) { +func (r *Relayer) NewPluginProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.PluginProvider, error) { return nil, errors.New("plugin provider is not supported for solana") } -func (r *Relayer) NewOCR3CapabilityProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.OCR3CapabilityProvider, error) { +func (r *Relayer) NewOCR3CapabilityProvider(ctx context.Context, rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.OCR3CapabilityProvider, error) { return nil, errors.New("ocr3 capability provider is not supported for solana") } diff --git a/pkg/solana/report.go b/pkg/solana/report.go index 572ac6023..99c949b5b 100644 --- a/pkg/solana/report.go +++ b/pkg/solana/report.go @@ -1,6 +1,7 @@ package solana import ( + "context" "encoding/binary" "fmt" "math/big" @@ -15,7 +16,7 @@ var _ median.ReportCodec = (*ReportCodec)(nil) type ReportCodec struct{} -func (c ReportCodec) BuildReport(oo []median.ParsedAttributedObservation) (types.Report, error) { +func (c ReportCodec) BuildReport(ctx context.Context, oo []median.ParsedAttributedObservation) (types.Report, error) { n := len(oo) if n == 0 { return nil, fmt.Errorf("cannot build report from empty attributed observations") @@ -78,7 +79,7 @@ func (c ReportCodec) BuildReport(oo []median.ParsedAttributedObservation) (types return types.Report(report), nil } -func (c ReportCodec) MedianFromReport(report types.Report) (*big.Int, error) { +func (c ReportCodec) MedianFromReport(ctx context.Context, report types.Report) (*big.Int, error) { // report should contain timestamp + observers + median + juels per eth if len(report) != int(ReportLen) { return nil, fmt.Errorf("report length mismatch: %d (received), %d (expected)", len(report), ReportLen) @@ -91,7 +92,7 @@ func (c ReportCodec) MedianFromReport(report types.Report) (*big.Int, error) { return bigbigendian.DeserializeSigned(int(MedianLen), median) } -func (c ReportCodec) MaxReportLength(n int) (int, error) { +func (c ReportCodec) MaxReportLength(ctx context.Context, n int) (int, error) { return int(ReportLen), nil } diff --git a/pkg/solana/report_fuzz_test.go b/pkg/solana/report_fuzz_test.go index 5aaa1cb19..34027d476 100644 --- a/pkg/solana/report_fuzz_test.go +++ b/pkg/solana/report_fuzz_test.go @@ -11,13 +11,15 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median" + + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) // Ensure your env is using go 1.18 then in pkg/solana: // go test -tags=go1.18 -fuzz ./... func FuzzReportCodecMedianFromReport(f *testing.F) { cdc := ReportCodec{} - report, err := cdc.BuildReport([]median.ParsedAttributedObservation{ + report, err := cdc.BuildReport(tests.Context(f), []median.ParsedAttributedObservation{ {Timestamp: uint32(time.Now().Unix()), Value: big.NewInt(10), JuelsPerFeeCoin: big.NewInt(100000)}, {Timestamp: uint32(time.Now().Unix()), Value: big.NewInt(10), JuelsPerFeeCoin: big.NewInt(200000)}, {Timestamp: uint32(time.Now().Unix()), Value: big.NewInt(11), JuelsPerFeeCoin: big.NewInt(300000)}}) @@ -26,11 +28,12 @@ func FuzzReportCodecMedianFromReport(f *testing.F) { // Seed with valid report f.Add([]byte(report)) f.Fuzz(func(t *testing.T, report []byte) { - med, err := cdc.MedianFromReport(report) + ctx := tests.Context(t) + med, err := cdc.MedianFromReport(ctx, report) if err == nil { // Should always be able to build a report from the medians extracted // Note however that juelsPerFeeCoin is only 8 bytes, so we can use the median for it - _, err = cdc.BuildReport([]median.ParsedAttributedObservation{{Timestamp: uint32(time.Now().Unix()), Value: med, JuelsPerFeeCoin: big.NewInt(100000)}}) + _, err = cdc.BuildReport(ctx, []median.ParsedAttributedObservation{{Timestamp: uint32(time.Now().Unix()), Value: med, JuelsPerFeeCoin: big.NewInt(100000)}}) require.NoError(t, err) } }) diff --git a/pkg/solana/report_test.go b/pkg/solana/report_test.go index 4f4b38bdd..84452dada 100644 --- a/pkg/solana/report_test.go +++ b/pkg/solana/report_test.go @@ -16,9 +16,11 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-common/pkg/utils" + "github.com/smartcontractkit/chainlink-common/pkg/utils/tests" ) func TestBuildReport(t *testing.T) { + ctx := tests.Context(t) c := ReportCodec{} oo := []median.ParsedAttributedObservation{} @@ -40,7 +42,7 @@ func TestBuildReport(t *testing.T) { observers[i] = uint8(i) } - report, err := c.BuildReport(oo) + report, err := c.BuildReport(ctx, oo) assert.NoError(t, err) // validate length @@ -75,7 +77,7 @@ func TestMedianFromOnChainReport(t *testing.T) { 13, 224, 182, 179, 167, 100, 0, 0, // juels per luna (1 with 18 decimal places) } - res, err := c.MedianFromReport(report) + res, err := c.MedianFromReport(tests.Context(t), report) assert.NoError(t, err) assert.Equal(t, "1234567890", res.String()) } @@ -89,7 +91,7 @@ type medianTest struct { func TestMedianFromReport(t *testing.T) { cdc := ReportCodec{} // Requires at least one obs - _, err := cdc.BuildReport(nil) + _, err := cdc.BuildReport(tests.Context(t), nil) require.Error(t, err) var tt = []medianTest{ { @@ -143,6 +145,7 @@ func TestMedianFromReport(t *testing.T) { for _, tc := range tt { tc := tc t.Run(tc.name, func(t *testing.T) { + ctx := tests.Context(t) var pos []median.ParsedAttributedObservation for i, obs := range tc.obs { pos = append(pos, median.ParsedAttributedObservation{ @@ -151,12 +154,12 @@ func TestMedianFromReport(t *testing.T) { Observer: commontypes.OracleID(uint8(i))}, ) } - report, err := cdc.BuildReport(pos) + report, err := cdc.BuildReport(ctx, pos) require.NoError(t, err) - max, err := cdc.MaxReportLength(len(tc.obs)) + max, err := cdc.MaxReportLength(ctx, len(tc.obs)) require.NoError(t, err) assert.Equal(t, len(report), max) - med, err := cdc.MedianFromReport(report) + med, err := cdc.MedianFromReport(ctx, report) require.NoError(t, err) assert.Equal(t, tc.expectedMedian.String(), med.String()) count, err := cdc.ObserversCountFromReport(report) @@ -202,6 +205,7 @@ func TestHashReport(t *testing.T) { } func TestNegativeMedianValue(t *testing.T) { + ctx := tests.Context(t) c := ReportCodec{} oo := []median.ParsedAttributedObservation{ median.ParsedAttributedObservation{ @@ -213,7 +217,7 @@ func TestNegativeMedianValue(t *testing.T) { } // create report - report, err := c.BuildReport(oo) + report, err := c.BuildReport(ctx, oo) assert.NoError(t, err) // check report properly encoded negative number @@ -229,12 +233,13 @@ func TestNegativeMedianValue(t *testing.T) { assert.True(t, oo[0].Value.Cmp(medianFromRaw.BigInt()) == 0, "median observation in raw report does not match") // check report can be parsed properly with a negative number - res, err := c.MedianFromReport(report) + res, err := c.MedianFromReport(ctx, report) assert.NoError(t, err) assert.True(t, oo[0].Value.Cmp(res) == 0) } func TestReportHandleOverflow(t *testing.T) { + ctx := tests.Context(t) // too large observation should not cause panic c := ReportCodec{} oo := []median.ParsedAttributedObservation{ @@ -245,7 +250,7 @@ func TestReportHandleOverflow(t *testing.T) { Observer: commontypes.OracleID(0), }, } - _, err := c.BuildReport(oo) + _, err := c.BuildReport(ctx, oo) assert.Error(t, err) // too large juelsPerFeeCoin should not cause panic @@ -257,6 +262,6 @@ func TestReportHandleOverflow(t *testing.T) { Observer: commontypes.OracleID(0), }, } - _, err = c.BuildReport(oo) + _, err = c.BuildReport(ctx, oo) assert.Error(t, err) } diff --git a/pkg/solana/transmitter.go b/pkg/solana/transmitter.go index e524470d5..ca5a55dc9 100644 --- a/pkg/solana/transmitter.go +++ b/pkg/solana/transmitter.go @@ -101,6 +101,6 @@ func (c *Transmitter) LatestConfigDigestAndEpoch( return state.Config.LatestConfigDigest, state.Config.Epoch, err } -func (c *Transmitter) FromAccount() (types.Account, error) { +func (c *Transmitter) FromAccount(ctx context.Context) (types.Account, error) { return types.Account(c.transmissionSigner.String()), nil } diff --git a/pkg/solana/txm/txm.go b/pkg/solana/txm/txm.go index a5700bd8b..b5aa8ba14 100644 --- a/pkg/solana/txm/txm.go +++ b/pkg/solana/txm/txm.go @@ -37,17 +37,17 @@ type SimpleKeystore interface { // Txm manages transactions for the solana blockchain. // simple implementation with no persistently stored txs type Txm struct { - starter services.StateMachine - lggr logger.Logger - chSend chan pendingTx - chSim chan pendingTx - chStop services.StopChan - done sync.WaitGroup - cfg config.Config - txs PendingTxContext - ks SimpleKeystore - client *utils.LazyLoad[client.ReaderWriter] - fee fees.Estimator + services.StateMachine + lggr logger.Logger + chSend chan pendingTx + chSim chan pendingTx + chStop services.StopChan + done sync.WaitGroup + cfg config.Config + txs PendingTxContext + ks SimpleKeystore + client *utils.LazyLoad[client.ReaderWriter] + fee fees.Estimator } type pendingTx struct { @@ -60,7 +60,7 @@ type pendingTx struct { // NewTxm creates a txm. Uses simulation so should only be used to send txes to trusted contracts i.e. OCR. func NewTxm(chainID string, tc func() (client.ReaderWriter, error), cfg config.Config, ks SimpleKeystore, lggr logger.Logger) *Txm { return &Txm{ - lggr: lggr, + lggr: logger.Named(lggr, "Txm"), chSend: make(chan pendingTx, MaxQueueLen), // queue can support 1000 pending txs chSim: make(chan pendingTx, MaxQueueLen), // queue can support 1000 pending txs chStop: make(chan struct{}), @@ -73,7 +73,7 @@ func NewTxm(chainID string, tc func() (client.ReaderWriter, error), cfg config.C // Start subscribes to queuing channel and processes them. func (txm *Txm) Start(ctx context.Context) error { - return txm.starter.StartOnce("solana_txm", func() error { + return txm.StartOnce("Txm", func() error { // determine estimator type var estimator fees.Estimator var err error @@ -541,22 +541,14 @@ func (txm *Txm) InflightTxs() int { // Close close service func (txm *Txm) Close() error { - return txm.starter.StopOnce("solanatxm", func() error { + return txm.StopOnce("Txm", func() error { close(txm.chStop) txm.done.Wait() return txm.fee.Close() }) } -func (txm *Txm) Name() string { return "solanatxm" } +func (txm *Txm) Name() string { return txm.lggr.Name() } -// Healthy service is healthy -func (txm *Txm) Healthy() error { - return nil +func (txm *Txm) HealthReport() map[string]error { + return map[string]error{txm.Name(): txm.Healthy()} } - -// Ready service is ready -func (txm *Txm) Ready() error { - return nil -} - -func (txm *Txm) HealthReport() map[string]error { return map[string]error{txm.Name(): txm.Healthy()} }