Skip to content

Commit e5cb874

Browse files
feat(cli): migrate forge clone and audit compliant cast commands (#14974)
* feat(cli): migrate forge clone and audit compliant cast commands * clippy * clippy
1 parent 0c84306 commit e5cb874

3 files changed

Lines changed: 19 additions & 19 deletions

File tree

crates/forge/src/cmd/clone.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,13 @@ impl CloneArgs {
161161
eyre::eyre!("No Etherscan API key configured for chain {chain}")
162162
})?
163163
.into_client_with_no_proxy(config.eth_rpc_no_proxy)?;
164-
sh_println!("Downloading the source code of {address} from Etherscan...")?;
164+
sh_status!("Downloading the source code of {address} from Etherscan...")?;
165165
let meta = Self::collect_metadata_from_client(address, &client).await?;
166166
(meta, "Etherscan", None)
167167
}
168168
SourceExplorer::Sourcify => {
169169
let client = SourcifyClient::with_url(chain, sourcify_url.as_deref());
170-
sh_println!("Downloading the source code of {address} from Sourcify...")?;
170+
sh_status!("Downloading the source code of {address} from Sourcify...")?;
171171
let meta = Self::collect_metadata_from_client(address, &client).await?;
172172
(meta, "Sourcify", Some(client))
173173
}
@@ -184,7 +184,7 @@ impl CloneArgs {
184184
.await?;
185185

186186
// step 4. collect the compilation metadata
187-
sh_println!("Collecting the creation information of {address} from {explorer_name}...")?;
187+
sh_status!("Collecting the creation information of {address} from {explorer_name}...")?;
188188

189189
match source {
190190
SourceExplorer::Etherscan => {

crates/forge/tests/cli/cmd.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -774,19 +774,19 @@ forgetest!(flaky_can_clone, |prj, cmd| {
774774
.arg(prj.root())
775775
.assert_success()
776776
.stdout_eq(str![[r#"
777-
Downloading the source code of 0x044b75f554b886A065b9567891e45c79542d7357 from Etherscan...
778777
Installing forge-std in [..] (url: https://github.com/foundry-rs/forge-std, tag: None)
779778
Installed forge-std[..]
780-
Collecting the creation information of 0x044b75f554b886A065b9567891e45c79542d7357 from Etherscan...
781779
[COMPILING_FILES] with [SOLC_VERSION]
782780
[SOLC_VERSION] [ELAPSED]
783781
Compiler run successful!
784782
785783
"#]])
786784
.stderr_eq(str![[r#"
785+
Downloading the source code of 0x044b75f554b886A065b9567891e45c79542d7357 from Etherscan...
787786
Initializing [..]...
788787
...
789788
Initialized forge project
789+
Collecting the creation information of 0x044b75f554b886A065b9567891e45c79542d7357 from Etherscan...
790790
791791
"#]]);
792792

@@ -835,19 +835,19 @@ forgetest!(flaky_can_clone_sourcify, |prj, cmd| {
835835
.arg(prj.root())
836836
.assert_success()
837837
.stdout_eq(str![[r#"
838-
Downloading the source code of 0xDb53f47aC61FE54F456A4eb3E09832D08Dd7BEec from Sourcify...
839838
Installing forge-std in [..] (url: https://github.com/foundry-rs/forge-std, tag: None)
840839
Installed forge-std[..]
841-
Collecting the creation information of 0xDb53f47aC61FE54F456A4eb3E09832D08Dd7BEec from Sourcify...
842840
[COMPILING_FILES] with [SOLC_VERSION]
843841
[SOLC_VERSION] [ELAPSED]
844842
Compiler run successful!
845843
846844
"#]])
847845
.stderr_eq(str![[r#"
846+
Downloading the source code of 0xDb53f47aC61FE54F456A4eb3E09832D08Dd7BEec from Sourcify...
848847
Initializing [..]...
849848
...
850849
Initialized forge project
850+
Collecting the creation information of 0xDb53f47aC61FE54F456A4eb3E09832D08Dd7BEec from Sourcify...
851851
852852
"#]]);
853853

@@ -872,19 +872,19 @@ forgetest!(flaky_can_clone_no_remappings_txt, |prj, cmd| {
872872
.arg(prj.root())
873873
.assert_success()
874874
.stdout_eq(str![[r#"
875-
Downloading the source code of 0x33e690aEa97E4Ef25F0d140F1bf044d663091DAf from Etherscan...
876875
Installing forge-std in [..] (url: https://github.com/foundry-rs/forge-std, tag: None)
877876
Installed forge-std[..]
878-
Collecting the creation information of 0x33e690aEa97E4Ef25F0d140F1bf044d663091DAf from Etherscan...
879877
[COMPILING_FILES] with [SOLC_VERSION]
880878
[SOLC_VERSION] [ELAPSED]
881879
Compiler run successful!
882880
883881
"#]])
884882
.stderr_eq(str![[r#"
883+
Downloading the source code of 0x33e690aEa97E4Ef25F0d140F1bf044d663091DAf from Etherscan...
885884
Initializing [..]...
886885
...
887886
Initialized forge project
887+
Collecting the creation information of 0x33e690aEa97E4Ef25F0d140F1bf044d663091DAf from Etherscan...
888888
889889
"#]]);
890890

@@ -1114,19 +1114,19 @@ forgetest!(flaky_can_clone_with_node_modules, |prj, cmd| {
11141114
.arg(prj.root())
11151115
.assert_success()
11161116
.stdout_eq(str![[r#"
1117-
Downloading the source code of 0xA3E217869460bEf59A1CfD0637e2875F9331e823 from Etherscan...
11181117
Installing forge-std in [..] (url: https://github.com/foundry-rs/forge-std, tag: None)
11191118
Installed forge-std[..]
1120-
Collecting the creation information of 0xA3E217869460bEf59A1CfD0637e2875F9331e823 from Etherscan...
11211119
[COMPILING_FILES] with [SOLC_VERSION]
11221120
[SOLC_VERSION] [ELAPSED]
11231121
Compiler run successful!
11241122
11251123
"#]])
11261124
.stderr_eq(str![[r#"
1125+
Downloading the source code of 0xA3E217869460bEf59A1CfD0637e2875F9331e823 from Etherscan...
11271126
Initializing [..]...
11281127
...
11291128
Initialized forge project
1129+
Collecting the creation information of 0xA3E217869460bEf59A1CfD0637e2875F9331e823 from Etherscan...
11301130
11311131
"#]]);
11321132
});

docs/dev/output-channels.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,20 @@ Each row's status is one of:
9595

9696
| Command | Text mode stdout | `--json` stdout | Status |
9797
| ---------------------- | ---------------------------------------------------- | -------------------------------------------------------------- | ------ |
98-
| `cast call` | Return value (hex / decoded) | JSON of return value | todo |
98+
| `cast call` | Return value (hex / decoded) | JSON of return value | migrated |
9999
| `cast send` | Tx hash | JSON of receipt or `{ "hash": "0x…" }` | todo |
100-
| `cast estimate` | Gas estimate (decimal) | JSON `{ "gas": "…" }` | todo |
101-
| `cast rpc` | RPC result (JSON) | JSON | todo |
102-
| `cast storage` | Single slot value | JSON of layout | todo |
100+
| `cast estimate` | Gas estimate (decimal) | JSON `{ "gas": "…" }` | migrated |
101+
| `cast rpc` | RPC result (JSON) | JSON | migrated |
102+
| `cast storage` | Single slot value | JSON of layout | migrated |
103103
| `cast logs` | One log per line | JSON array | todo |
104104
| `cast run` | Trace / decoded output | JSON | migrated |
105-
| `cast trace` | Trace | JSON trace | todo |
105+
| `cast trace` | Trace | JSON trace | migrated |
106106
| `cast wallet new` | Address | JSON `{ "address": "…", "private_key": "…" (only with explicit flag) }` | todo |
107107
| `cast wallet sign` | Signature | JSON | todo |
108108
| `cast erc20 balance` | Balance (decimal) | JSON string | todo |
109-
| `cast access-list` | Access list | JSON | todo |
109+
| `cast access-list` | Access list | JSON | migrated |
110110
| `cast da-estimate` | Gas estimate | JSON | todo |
111-
| `cast find-block` | Block number | JSON | todo |
111+
| `cast find-block` | Block number | JSON | migrated |
112112
| `cast mktx` | Signed RLP | JSON | todo |
113113
| `cast batch-send` | One tx hash per line | JSON array | todo |
114114

@@ -124,7 +124,7 @@ Each row's status is one of:
124124
| `forge init` | (empty) | (empty) | migrated |
125125
| `forge update` | (empty) | (empty) | migrated |
126126
| `forge remove` | (empty) | (empty) | migrated |
127-
| `forge clone` | (empty) | (empty) | todo |
127+
| `forge clone` | (empty) | (empty) | migrated |
128128
| `forge bind` | (empty) | (empty) | migrated |
129129
| `forge bind-json` | (empty) or generated path | JSON | migrated |
130130
| `forge flatten` | Flattened source | n/a | migrated |

0 commit comments

Comments
 (0)