Skip to content

Commit 4d07808

Browse files
authored
chore: restore openchain support (#11915)
Revert "fix: use sourcify for selector lookups (#11757)" This reverts commit e9764bb.
1 parent b6d0c06 commit 4d07808

File tree

10 files changed

+540
-236
lines changed

10 files changed

+540
-236
lines changed

Cargo.lock

Lines changed: 94 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/cast/src/args.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ use foundry_common::{
1919
fmt::{format_tokens, format_uint_exp, serialize_value_as_json},
2020
fs,
2121
selectors::{
22-
SelectorKind, decode_calldata, decode_event_topic, decode_function_selector,
23-
decode_selectors, pretty_calldata,
22+
ParsedSignatures, SelectorImportData, SelectorKind, decode_calldata, decode_event_topic,
23+
decode_function_selector, decode_selectors, import_selectors, parse_signatures,
24+
pretty_calldata,
2425
},
2526
shell, stdin,
2627
};
@@ -593,11 +594,15 @@ pub async fn run_command(args: CastArgs) -> Result<()> {
593594
sh_println!("{sig}")?
594595
}
595596
}
596-
CastSubcommand::UploadSignature { .. } => {
597-
sh_warn!(
598-
"Selector uploading is deprecated and is currently a no-op, as the upstream API has been removed."
599-
)?;
600-
sh_warn!("To upload selectors in the future, verify your contracts with Sourcify.")?;
597+
CastSubcommand::UploadSignature { signatures } => {
598+
let signatures = stdin::unwrap_vec(signatures)?;
599+
let ParsedSignatures { signatures, abis } = parse_signatures(signatures);
600+
if !abis.is_empty() {
601+
import_selectors(SelectorImportData::Abi(abis)).await?.describe();
602+
}
603+
if !signatures.is_empty() {
604+
import_selectors(SelectorImportData::Raw(signatures)).await?.describe();
605+
}
601606
}
602607

603608
// ENS

crates/cast/src/opts.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ pub enum CastSubcommand {
595595
/// Decode event data.
596596
#[command(visible_aliases = &["event-decode", "--event-decode", "ed"])]
597597
DecodeEvent {
598-
/// The event signature. If none provided then tries to decode from local cache or <https://docs.sourcify.dev/docs/api/>.
598+
/// The event signature. If none provided then tries to decode from local cache or <https://api.openchain.xyz>.
599599
#[arg(long, visible_alias = "event-sig")]
600600
sig: Option<String>,
601601
/// The event data to decode.
@@ -605,7 +605,7 @@ pub enum CastSubcommand {
605605
/// Decode custom error data.
606606
#[command(visible_aliases = &["error-decode", "--error-decode", "erd"])]
607607
DecodeError {
608-
/// The error signature. If none provided then tries to decode from local cache or <https://docs.sourcify.dev/docs/api/>.
608+
/// The error signature. If none provided then tries to decode from local cache or <https://api.openchain.xyz>.
609609
#[arg(long, visible_alias = "error-sig")]
610610
sig: Option<String>,
611611
/// The error data to decode.
@@ -720,29 +720,29 @@ pub enum CastSubcommand {
720720
rpc: RpcOpts,
721721
},
722722

723-
/// Get the function signatures for the given selector from <https://docs.sourcify.dev/docs/api/>.
723+
/// Get the function signatures for the given selector from <https://openchain.xyz>.
724724
#[command(name = "4byte", visible_aliases = &["4", "4b"])]
725725
FourByte {
726726
/// The function selector.
727727
selector: Option<Selector>,
728728
},
729729

730-
/// Decode ABI-encoded calldata using <https://docs.sourcify.dev/docs/api/>.
730+
/// Decode ABI-encoded calldata using <https://openchain.xyz>.
731731
#[command(name = "4byte-calldata", aliases = &["4byte-decode", "4d", "4bd"], visible_aliases = &["4c", "4bc"])]
732732
FourByteCalldata {
733733
/// The ABI-encoded calldata.
734734
calldata: Option<String>,
735735
},
736736

737-
/// Get the event signature for a given topic 0 from <https://docs.sourcify.dev/docs/api/>.
737+
/// Get the event signature for a given topic 0 from <https://openchain.xyz>.
738738
#[command(name = "4byte-event", visible_aliases = &["4e", "4be", "topic0-event", "t0e"])]
739739
FourByteEvent {
740740
/// Topic 0
741741
#[arg(value_name = "TOPIC_0")]
742742
topic: Option<B256>,
743743
},
744744

745-
/// DEPRECATED: Upload the given signatures to <https://docs.sourcify.dev/docs/api/>.
745+
/// Upload the given signatures to <https://openchain.xyz>.
746746
///
747747
/// Example inputs:
748748
/// - "transfer(address,uint256)"
@@ -760,13 +760,13 @@ pub enum CastSubcommand {
760760

761761
/// Pretty print calldata.
762762
///
763-
/// Tries to decode the calldata using <https://docs.sourcify.dev/docs/api/> unless --offline is passed.
763+
/// Tries to decode the calldata using <https://openchain.xyz> unless --offline is passed.
764764
#[command(visible_alias = "pc")]
765765
PrettyCalldata {
766766
/// The calldata.
767767
calldata: Option<String>,
768768

769-
/// Skip the <https://docs.sourcify.dev/docs/api/> lookup.
769+
/// Skip the <https://openchain.xyz> lookup.
770770
#[arg(long, short)]
771771
offline: bool,
772772
},
@@ -1126,7 +1126,7 @@ pub enum CastSubcommand {
11261126
/// The hex-encoded bytecode.
11271127
bytecode: Option<String>,
11281128

1129-
/// Resolve the function signatures for the extracted selectors using <https://docs.sourcify.dev/docs/api/>
1129+
/// Resolve the function signatures for the extracted selectors using <https://openchain.xyz>
11301130
#[arg(long, short)]
11311131
resolve: bool,
11321132
},

crates/cast/tests/cli/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ casttest!(mktx_raw_unsigned_no_from_missing_nonce, |_prj, cmd| {
16861686
"--chain",
16871687
"1",
16881688
"--gas-limit",
1689-
"21000",
1689+
"21000",
16901690
"--gas-price",
16911691
"20000000000",
16921692
"0x742d35Cc6634C0532925a3b8D6Ac6F67C9c2b7FD",
@@ -3384,7 +3384,7 @@ Traces:
33843384
│ ├─ [2553] 0x2Ce6311ddAE708829bc0784C967b7d77D19FD779::balanceOf(0xA12384c5E52fD646E7BC7F6B3b33A605651F566E) [delegatecall]
33853385
│ │ └─ ← [Return] 0x000000000000000000000000000000000000000000000000000000000000f3b9
33863386
│ └─ ← [Return] 0x000000000000000000000000000000000000000000000000000000000000f3b9
3387-
├─ [65442] 0xc2FF493F28e894742b968A7DB5D3F21F0aD80C6c::fulfillBasicOrder_efficient_6GL6yc()
3387+
├─ [65442] 0xc2FF493F28e894742b968A7DB5D3F21F0aD80C6c::00000000(00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a12384c5e52fd646e7bc7f6b3b33a605651f566e000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f0000000000000000000000000000000000000000000000000000000000036cd000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000327a25ad5cfe5c4d4339c1a4267d4a83e8c93312000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000b55b053230e4effb6609de652fca73fd1c2980400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000221000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
33883388
│ ├─ [25070] 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E::unwrapAndValidateSignature(0x290a4c4039f102eceba2147e1fcc46f994a46d1229faf43ffff26a058e7378ff, 0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b00) [staticcall]
33893389
│ │ ├─ [22067] 0x0B55b053230E4EFFb6609de652fCa73Fd1C29804::unwrapAndValidateSignature(0x290a4c4039f102eceba2147e1fcc46f994a46d1229faf43ffff26a058e7378ff, 0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b00) [delegatecall]
33903390
│ │ │ ├─ [2369] 0xc2FF493F28e894742b968A7DB5D3F21F0aD80C6c::pauseFlag() [staticcall]
@@ -3418,7 +3418,7 @@ Traces:
34183418
│ │ ├─ [553] 0x2Ce6311ddAE708829bc0784C967b7d77D19FD779::balanceOf(0x327a25aD5Cfe5c4D4339C1A4267D4a83E8c93312) [delegatecall]
34193419
│ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000009c9a
34203420
│ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000009c9a
3421-
│ ├─ [5675] 0xc2FF493F28e894742b968A7DB5D3F21F0aD80C6c::multicallN2M_001Taw5z()
3421+
│ ├─ [5675] 0xc2FF493F28e894742b968A7DB5D3F21F0aD80C6c::00000001(00000000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b290a4c4039f102eceba2147e1fcc46f994a46d1229faf43ffff26a058e7378ff0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000a12384c5e52fd646e7bc7f6b3b33a605651f566e000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000170000000000000000000000000000000000000000000000000000000000000000000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f0000000000000000000000000000000000000000000000000000000000036cd000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000000000000000000000000000000000000000060f000000000000000000000000327a25ad5cfe5c4d4339c1a4267d4a83e8c93312000000000000000000000000000000000000000000000000000000000000034000000000000000000000000000000000000000000000000000000000000005a00000000000000000000000000b55b053230e4effb6609de652fca73fd1c2980400000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000221000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006cdd519280ec730727f07aa36550bde31a1d5f3097818f3425c2f083ed33a91f080fa2afac0071f6e1af9a0e9c09b851bf01e68bc8a1c1f89f686c48205762f92500000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b51704d51446e7841757a726f68522d483878472d5a536b625249702d76515f5f5f4a714259357a655038222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000001bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
34223422
│ │ ├─ [4148] 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E::execute(0x0100000000007821000100000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000201bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b)
34233423
│ │ │ ├─ [3693] 0x0B55b053230E4EFFb6609de652fCa73Fd1C29804::execute(0x0100000000007821000100000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000201bde17b8de18819c9eb86cefc3920ddb5d3d4254de276e3d6e18dd2b399f732b) [delegatecall]
34243424
│ │ │ │ ├─ [435] 0xA12384c5E52fD646E7BC7F6B3b33A605651F566E::fallback()
@@ -3586,12 +3586,12 @@ forgetest_async!(cast_send_create_with_constructor_args, |prj, cmd| {
35863586
contract ConstructorContract {
35873587
uint256 public value;
35883588
string public name;
3589-
3589+
35903590
constructor(uint256 _value, string memory _name) {
35913591
value = _value;
35923592
name = _name;
35933593
}
3594-
3594+
35953595
function getValue() public view returns (uint256) {
35963596
return value;
35973597
}
@@ -3665,7 +3665,7 @@ casttest!(cast_estimate_create_with_constructor_args, |prj, cmd| {
36653665
contract EstimateContract {
36663666
uint256 public value;
36673667
string public name;
3668-
3668+
36693669
constructor(uint256 _value, string memory _name) {
36703670
value = _value;
36713671
name = _name;
@@ -3767,13 +3767,13 @@ contract ComplexContract {
37673767
address public owner;
37683768
uint256[] public values;
37693769
bool public active;
3770-
3770+
37713771
constructor(address _owner, uint256[] memory _values, bool _active) {
37723772
owner = _owner;
37733773
values = _values;
37743774
active = _active;
37753775
}
3776-
3776+
37773777
function getValuesLength() public view returns (uint256) {
37783778
return values.length;
37793779
}

0 commit comments

Comments
 (0)