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

Feat: Index cheatcode for Strings #7539

Merged
merged 5 commits into from
Apr 4, 2024
Merged

Conversation

kamuik16
Copy link
Contributor

@kamuik16 kamuik16 commented Apr 2, 2024

Motivation

Closes #7487

It is my first time adding a cheatcode so let me know if I have done something wrong.

Ran 1 test for default/cheats/StringUtils.t.sol:StringManipulationTest
[PASS] testIndexOf() (gas: 7144)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 6.98ms (3.82ms CPU time)

Ran 1 test suite in 57.78ms (6.98ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests)

@kamuik16 kamuik16 requested review from DaniPopes and mds1 April 4, 2024 03:50
Copy link
Member

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

FYI I've edited the description to use GitHub keywords when referencing issues.

Pending another approval.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

crates/cheatcodes/spec/src/vm.rs Show resolved Hide resolved
@mattsse mattsse merged commit 1281421 into foundry-rs:master Apr 4, 2024
19 checks passed
@kamuik16 kamuik16 deleted the kamuik16/7487 branch April 5, 2024 02:39
klkvr pushed a commit that referenced this pull request Apr 6, 2024
* feat: index cheatcode

* some nits to make it work

* nit: use as_str()

* final changes

* chore: reviewed changes
mattsse added a commit that referenced this pull request Apr 9, 2024
* chore: make cast use an alloy provider

* move initial methods to alloy

* feat(`foundry-common`): NameOrAddress ENS util (#7122)

* feat(foundry-common): NameOrAddress ENS util

* chore: rename err

* chore: remove from impl for str

* chore: unrelated fix from alloy upgrade

* nit

* feat(`cast`): Move non `tx` methods to alloy (#7129)

* chore: add alloy contract

* feat(cast): migrate most methods to alloy

* chore: leave todo for converting a tx envelope into an rpc tx

* fix: use proper type for storage

* readd decodetx for now

* chore: extend txbuilder to build an alloy tx request

* feat: migrate most methods bar send/decode raw tx

* fix: include tx data

* simplify txbuilder

* chore: simplify back access_list

* chore: remove unnecesary conversion

* fmt

* doctests

* fmt

* do not use trait

* Update crates/cast/bin/main.rs

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* cleanup builder

* clippy

* fix doc comments

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>

* DocumentMut

* wip

* wip

* wip: bump alloy

* wip

* wip

* wip

* [wip] migrate to alloy providers and signers (#7425)

wip

* fix wallets after alloy bump

* clean up deps

* use serde on consensus types

* update TypedTransaction for anvil

* make anvil compile

* wip: make script compile

* fix script

* make forge compile

* fix: anvil tests

* bump alloy

* fix tests

* fix tx builder

* fix cargo.toml

* fix cargo.toml

* fix script gas price logic

* remove ethers from anvil

* clippy

* rm all_derives

* deps

* fmt

* fix tests

* configure clippy

* clippy

* add feature

* fix cargo deny

* fix persist

* fix doctests

* fmt

* fix clap

* review fixes

* fmt

* bump alloy

* Update cargo.toml

* fmt

* fixes

* ethers clean-up

* fix(fmt): fix indent closing parenthesis enclosed in { } (#7557)

* fix(fmt): fix indent closing parenthesis enclosed in { }

* Fix testdata bad formatting

* feat(test): only compile files needed for tests (#7334)

* feat(forge test): only compile files needed for tests

* remove comment

* clippy

* update fixtures

* getCode + getDeployedCode updates

* fixes

* fix path matching

* clippy

* add config flag

* fix

* docs

* fmt

* patch compilers

* fix Cargo.toml

* update patch

* update patch

* doc

* rm space

* cargo cheats

* new output selection fn

* log compiler errors on failure

* fixes

* fix: do not flood dictionary with data dependent on fuzz inputs (#7552)

* fix dictionary

* clippy + fmt

* fix

* Feat: Index cheatcode for Strings (#7539)

* feat: index cheatcode

* some nits to make it work

* nit: use as_str()

* final changes

* chore: reviewed changes

* chore: reduce logs in tests (#7566)

* fix(script): decode custom error in script fail message (#7563)

* clippy

* bump alloy

* AnyNetwork

* bump alloy

* add comment

* clippy

* bump alloy

* fixes

* refactor cast logs to use alloy (#7594)

* refactor cast logs to use alloy

* fmt

* make clippy happy

* cleanup

* doc nits

---------

Co-authored-by: evalir <hi@enriqueortiz.dev>

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
Co-authored-by: Krishang <93703995+kamuik16@users.noreply.github.com>
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Co-authored-by: bernard-wagner <bernard-wagner@users.noreply.github.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.

Feature request: input.index(key)
4 participants