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

Revisit usages of binary_search in containers that can contain duplicates #318

Closed
kianenigma opened this issue May 29, 2021 · 2 comments
Closed
Labels
I4-refactor Code needs refactoring. T1-FRAME This PR/Issue is related to core FRAME, the framework.

Comments

@kianenigma
Copy link
Contributor

The recent events has thought us the hard way that we should not use binary search if a container can have duplicates. The society pallet is a good example of what should be done if there are duplicates: https://github.com/paritytech/substrate/blob/master/frame/society/src/lib.rs#L1205

@kianenigma
Copy link
Contributor Author

cc @shawntabrizi

@bkchr
Copy link
Member

bkchr commented Jun 11, 2021

I have reviewed all of them, beside the problematic one paritytech/substrate#9049 I didn't have found anything that needs to be rewritten.

@juangirini juangirini transferred this issue from paritytech/substrate Aug 24, 2023
@the-right-joyce the-right-joyce added I4-refactor Code needs refactoring. T1-FRAME This PR/Issue is related to core FRAME, the framework. and removed I7-refactor labels Aug 25, 2023
helin6 pushed a commit to boolnetwork/polkadot-sdk that referenced this issue Feb 5, 2024
* Bump substrate to latest of frontier branch (ca63242)

* Bump substrate to version 3.0.0

This also bumps some of frontier's own versions from 2.0.0 to 3.0.0

* Bump sp-consensus from 0.8.0 -> 0.9.0

* Specify parity-scale-codec v2.0.0

* Bump ethereum from v0.6 to v0.7.1

This should resolve the funty/bitcvec compile issues

* Bump evm version 0.23 -> 0.24

* Bump kvdb 0.8.0 -> 0.9.0 and kvdb-rocksdb 0.9.0 -> 0.11.0

* Update use of codec

* Incremental Cargo.lock update

* Bump ethereum-types and primitive-types
ethereum-types 0.10.0 -> 0.11.0
primitive-types 0.8.0 -> 0.9.0

* Reflect BlockBuilderApi changes

* Remove Inherent from Aura pallet

* Point all ethereum to v0.7.1

* Reflect telemetry_span changes and is_network_authority -> is_authority

* fix tests with test palletinfo

* Point new sp- dependencies to substrate 3.0.0

* Reflect parity-scale-codec changes

* Set OnTimestampSet to no-op instead of Aura

* Update Cargo.lock

* Reflect runtime logging refactor

* Use spawn_essential_handle() instead of spawn_handle()

* Point substrate to master/a8c2bc66ea8667a1dcbafa13ce184b020bd6f84b

* Update Cargo.lock

* Remove evm 0.23 entries from Cargo.lock / Cargo.toml

* Cherry-pick 8ea8614 (Use runtime's block gas limit in estimate_gas RPC call)

* Bump substrate a8c2bc6 -> 8a8c2bc

* Remove format! macro call form runtime

* Update Cargo.lock

* Reflect change to RandomnessCollectiveFlip

* Reflect Telemetry refactor

* Remove Option from GenesisConfig

* Incremental WIP refactoring telemetry

* Finish telemetry-related refactor

* Reflect modified error string in unit test

* Use desired substrate branch (frontier) and commit (8b3e5bc)

* Some clean up from telemetry refactor

* Point new Cargo.lock entry to substrate commit 8b3e5bc

* Restore missing comma

* Update Cargo.lock

* Remove ConsensusResult::Aura after merge conflict resolution

* Use substrate master branch temporarily

* Update old version of ethereum-types and parity-scale-codec

* Add default-features in frame/dynamic-fee

* Point substrate to frontier branch @ 8b3e5bc

* Point to evm commit that avoids no_std issue

* Revert "Point to evm commit that avoids no_std issue"

This reverts commit 6f48d043eb20b99b433bf5b9340f49ceb20a2766.

* Bump evm to version 0.25

* Bump CI rust version

* Revert "Bump CI rust version"

This reverts commit 7db02fbb7912554b03b2f8e7a5f74fc1fc415063.

* Use evm v0.25 in new precompile

* Add palletAura and palletGrandpa to test specs

* Revert "Cherry-pick 8ea8614 (Use runtime's block gas limit in estimate_gas RPC call)"

This reverts commit 753cf641d93461daf8c1b957366cc46acc984b0d.
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 26, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Mar 27, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 8, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 9, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
serban300 pushed a commit to serban300/polkadot-sdk that referenced this issue Apr 10, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
jonathanudd pushed a commit to jonathanudd/polkadot-sdk that referenced this issue Apr 10, 2024
* DummyOrdered relay: initial commit

* 1 ML file -> 3 files

* extracted generic message race loop

* uncommented race error procesing

* lane loop tests

* cargo fmt

* moved HeaderId to utils.rs

* restart lane loop on stall

* message delivery strategy tests

* removed obsolete code

* clippy

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* Update relays/ethereum/src/message_lane_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* added more races docs

* Update relays/ethereum/src/message_race_delivery.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* update docs

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>

* deal with TODOs

* removed docs

* docs

* cargo fmt --all

* Update relays/ethereum/src/message_race_loop.rs

Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>

Co-authored-by: Tomasz Drwięga <tomusdrw@users.noreply.github.com>
Co-authored-by: Hernando Castano <HCastano@users.noreply.github.com>
@github-project-automation github-project-automation bot moved this from Backlog to Done in Runtime / FRAME Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I4-refactor Code needs refactoring. T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
Status: Done
Development

No branches or pull requests

4 participants