Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -239,17 +239,17 @@ alloy-hardforks = { version = "0.2.6", default-features = false }
alloy-op-hardforks = { version = "0.2.6", default-features = false }

## alloy-core
alloy-dyn-abi = "1.1"
alloy-json-abi = "1.1"
alloy-primitives = { version = "1.1", features = [
alloy-dyn-abi = "1.2.1"
alloy-json-abi = "1.2.1"
alloy-primitives = { version = "1.2.1", features = [
"getrandom",
"rand",
"map-fxhash",
"map-foldhash",
] }
alloy-sol-macro-expander = "1.1"
alloy-sol-macro-input = "1.1"
alloy-sol-types = "1.1"
alloy-sol-macro-expander = "1.2.1"
alloy-sol-macro-input = "1.2.1"
alloy-sol-types = "1.2.1"

alloy-chains = "0.2"
alloy-rlp = "0.3"
Expand Down
78 changes: 78 additions & 0 deletions crates/cast/tests/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,84 @@ casttest!(wallet_sign_typed_data_file, |_prj, cmd| {
"#]]);
});

// tests that `cast wallet sign typed-data` passes with type names containing colons
// <https://github.com/foundry-rs/foundry/issues/10765>
casttest!(wallet_sign_typed_data_with_colon_succeeds, |_prj, cmd| {
let typed_data_with_colon = r#"{
"types": {
"EIP712Domain": [
{"name": "name", "type": "string"},
{"name": "version", "type": "string"},
{"name": "chainId", "type": "uint256"},
{"name": "verifyingContract", "type": "address"}
],
"Test:Message": [
{"name": "content", "type": "string"}
]
},
"primaryType": "Test:Message",
"domain": {
"name": "TestDomain",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"content": "Hello"
}
}"#;

cmd.args([
"wallet",
"sign",
"--private-key",
"0x0000000000000000000000000000000000000000000000000000000000000001",
"--data",
typed_data_with_colon,
]).assert_success().stdout_eq(str![[r#"
0xf91c67e845a4d468d1f876f457ffa01e65468641fc121453705242d21de39b266c278592b085814ab1e9adc938cc26b1d64bb61f80b437df077777c4283612291b

"#]]);
});

// tests that the same data without colon works correctly
// <https://github.com/foundry-rs/foundry/issues/10765>
casttest!(wallet_sign_typed_data_without_colon_works, |_prj, cmd| {
let typed_data_without_colon = r#"{
"types": {
"EIP712Domain": [
{"name": "name", "type": "string"},
{"name": "version", "type": "string"},
{"name": "chainId", "type": "uint256"},
{"name": "verifyingContract", "type": "address"}
],
"TestMessage": [
{"name": "content", "type": "string"}
]
},
"primaryType": "TestMessage",
"domain": {
"name": "TestDomain",
"version": "1",
"chainId": 1,
"verifyingContract": "0x0000000000000000000000000000000000000000"
},
"message": {
"content": "Hello"
}
}"#;

cmd.args([
"wallet",
"sign",
"--private-key",
"0x0000000000000000000000000000000000000000000000000000000000000001",
"--data",
typed_data_without_colon,
])
.assert_success();
});

// tests that `cast wallet sign-auth message` outputs the expected signature
casttest!(wallet_sign_auth, |_prj, cmd| {
cmd.args([
Expand Down