Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More alias handling in Unwrap functionality of Value #792

Merged
merged 5 commits into from
Sep 23, 2024

Conversation

kidambisrinivas
Copy link
Contributor

@kidambisrinivas kidambisrinivas commented Sep 23, 2024

Updates

  • Generic case to handle both pointer type and raw type of type aliases in generic unwrap[T] function
  • Simplify int unwrap to have common logic for different int types like int8, int16 etc.,. and alias handling using the above logic
  • Update values_test, bytes_test and add new test cases for int_test

Testing

$ go test -count=1 -v ./pkg/values
...
== RUN   Test_Aliases/int
=== RUN   Test_Aliases/[][]byte_->_[]aliasByte
=== RUN   Test_Aliases/aliasMap_->_map[string]any
--- PASS: Test_Aliases (0.00s)
    --- PASS: Test_Aliases/alias_to_[]byte (0.00s)
    --- PASS: Test_Aliases/simple_aliases (0.00s)
    --- PASS: Test_Aliases/aliasByte_->_[]byte (0.00s)
    --- PASS: Test_Aliases/[]aliasSingleByte_->_[]byte (0.00s)
    --- PASS: Test_Aliases/int (0.00s)
    --- PASS: Test_Aliases/[][]byte_->_[]aliasByte (0.00s)
    --- PASS: Test_Aliases/aliasMap_->_map[string]any (0.00s)
PASS
ok      github.com/smartcontractkit/chainlink-common/pkg/values 0.246s

ettec
ettec previously approved these changes Sep 23, 2024
cedric-cordenier added a commit that referenced this pull request Oct 4, 2024
* Generic case to handle both pointer type and raw type and simplify int unwrap

* Handling interface and default

* Small test fix

---------

Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>
cedric-cordenier added a commit that referenced this pull request Oct 10, 2024
* [CM-380] Identical Aggregator

* [CAPPL-60] Dynamic encoder selection in OCR consensus aggregator

* extract encoder name and config

* Add more tests

* add limit to seq num range (#781)

* [chore] Handle aliases in slices (#784)

* [chore] Handle aliases in slices

* More aliasing tests

* Lint fix

* Fix test

---------

Co-authored-by: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com>

* feat(observability-lib): legendoptions + improvement on node general dashboard (#785)

* [CAPPL-58] Correctly stub out clock_time_get and poll_oneoff (#778)

* [CAPPL-58] Further cleanup

* [CAPPL-58] Add support for compression

* More alias handling in Unwrap functionality of Value  (#792)

* Generic case to handle both pointer type and raw type and simplify int unwrap

* Handling interface and default

* Small test fix

---------

Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>

* Fix alias typing and tests (#788)

* Fix alias typing and tests

* Fix ints

* errors.new instead of fmt

* Add array support to slice (#789)

* Replace fmt.Errorf with errors.New where possible (#795)

* chore(workflows): adds unit test to utils (#782)

* Have the mock runner register with capabilites (#783)

* Add binary + config to custom compute (#794)

* Add binary + config to custom compute

* Add binary + config to custom compute

* fix lint issues (#786)

* execution factory constructor updated to take two providers, chainIDs, and source token address (#641)

* execution factory constructor updated to take two providers and chain IDs

(cherry picked from commit 6ad1f08)

* Adding source token address to execution factory constructor

* Support passing in a values.Value to the chainreader GetLatestValue method (#779)

* add support for passing in a values.Value type to the contract readers GetLatestValue and QueryKey methods

---------

Co-authored-by: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com>
Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>

* [CAPPL-31] feat(values): adds support for time.Time as value (#787)

* feat(values): adds support for time.Time as value

* chore(deps): updates .tool-versions

* refactor(values): uses primitive type in protos

* feat(values): support float64 values (#799)

* confidence level from string (#802)

* Float32/Float64 wrapping (#804)

* feat: implement sdk logger (#762)

* Add MustEmbed Constraint to Contract Reader (#801)

Reintroducing the must embed constraint to `ContractReader` implementations to
ensure that all implementations of `ContractReader` embed the `UnimplementedContractReader`.

If an implementation contains the unemplemented struct, changes to the interface
will flow down to all implementations without introducing breaking changes.

* Updated TestStruct to enable advanced querying (#798)

* Updated TestStruct to enable advanced querying

* linting fixes

* Update pkg/codec/encodings/type_codec_test.go

Co-authored-by: Clement <clement.erena78@gmail.com>

* Update pkg/codec/encodings/type_codec_test.go

Co-authored-by: Clement <clement.erena78@gmail.com>

* Fixed codec tests

---------

Co-authored-by: Clement <clement.erena78@gmail.com>

* Properly support the range of uint64 and allow big int to unwrap into smaller integer types (#810)

* Extract expirable cache abstraction for reuse (#807)

* expirable_cache

* remove cache (#812)

* CCIP-3555 Attestation encoder interfaces (#813)

* Attestation encoder interfaces

* Attestation encoder interfaces

* Attestation encoder interfaces

* Comment

* [BCF-3392]  - ContractReaderByIDs Wrapper (#797)

* WIP

* Update ContractReaderByIDs interface method names

* Unexpose types.ContractReader in contractReaderByIDs

* Add multiple contract address support to fakeContractReader for tests

* Add GetLatestValue unit test for contractReaderByIDs

* Add GetLatestValue unit test for QueryKey

* Add BatchGetLatestValues unit test for CR by custom IdDs wrapper

* Rm ContractReaderByIDs interface and export the struct

* Change ContractReaderByIDs wrapper Unbind handling

* Improve ContractReaderByIDs wrapper err handling

* Remove mockery usage from ContractReaderByIDs tests

* lint

* pkg/types/ccipocr3: add DestExecData to RampTokenAmount (#817)

* pkg/types/ccipocr3: add DestExecData to RampTokenAmount

* fix test

* Allow the creation of maps from string to capbility outputs. (#815)

* Add the FeeValueJuels field to ccipocr3.Message (#819)

* feat(observability-lib): improve alerts rule (#803)

* feat(observability-lib): improve alerts rule

* chore(observability-lib): README + folder structure (#806)

* chore(observability-lib): README + folder structure

* feat(observability-lib): variable add current + includeAll options (#808)

* chore(README): small corrections

* chore(README): example improved

* chore(README): add references to dashboards examples

* feat(observability-lib): refactor exportable func + link to godoc

* fix(observability-lib): cmd errors returns

* enable errorf check (#826)

* Make overridding the encoder first-class

* Update mocks

* Mock updates

* Adjust tests

* Fix mock

* Fix mock

* Update mock

* Linting

---------

Co-authored-by: Cedric Cordenier <cedric.cordenier@smartcontract.com>
Co-authored-by: dimitris <dimitrios.kouveris@smartcontract.com>
Co-authored-by: Sri Kidambi <1702865+kidambisrinivas@users.noreply.github.com>
Co-authored-by: Clement <clement.erena78@gmail.com>
Co-authored-by: Ryan Tinianov <tinianov@live.com>
Co-authored-by: Street <5597260+MStreet3@users.noreply.github.com>
Co-authored-by: Jordan Krage <jmank88@gmail.com>
Co-authored-by: Patrick <patrick.huie@smartcontract.com>
Co-authored-by: Matthew Pendrey <matthew.pendrey@gmail.com>
Co-authored-by: Gabriel Paradiso <gaboparadiso@gmail.com>
Co-authored-by: Awbrey Hughlett <athughlett@gmail.com>
Co-authored-by: Silas Lenihan <32529249+silaslenihan@users.noreply.github.com>
Co-authored-by: Mateusz Sekara <mateusz.sekara@gmail.com>
Co-authored-by: ilija42 <57732589+ilija42@users.noreply.github.com>
Co-authored-by: Makram <makramkd@users.noreply.github.com>
Co-authored-by: Ryan Stout <rstout610@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants