Skip to content

Commit 2fa9174

Browse files
committed
feat: modified verifyEd25519 precompile to accept msg argument as bytes32
1 parent f05829f commit 2fa9174

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

precompiles/verifier/ISolVerifier.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ interface ISolVerifier {
1414
/// @param msg The message that was signed
1515
/// @param signature The signature to verify
1616
/// @return isValid True if the signature is valid
17-
function verifyEd25519(bytes calldata pubKey, bytes calldata msg, bytes calldata signature) external view returns (bool);
17+
function verifyEd25519(bytes calldata pubKey, bytes32 msg, bytes calldata signature) external view returns (bool);
1818
}

precompiles/verifier/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ cd ../../
1515
# if you just get 0x, make sure the address is in the app_state["evm"]["params"]["active_static_precompiles"]
1616

1717
# precompile directly
18-
cast abi-decode "verifyEd25519(bytes,bytes,bytes)(bool)" `cast call 0x0000000000000000000000000000000000000902 "verifyEd25519(bytes,bytes,bytes)" \
18+
cast abi-decode "verifyEd25519(bytes,bytes32,bytes)(bool)" `cast call 0x0000000000000000000000000000000000000902 "verifyEd25519(bytes,bytes32,bytes)" \
1919
"5DgQvTf6BvVs5Y4vNFnB5iXvTQvZah7y2JbT1dFxN6T2" \
20-
0x68656c6c6f776f726c64 \
20+
0x68656c6c6f776f726...bytes32_message_here \
2121
0x6f7c...your_signature_here
2222
`
2323
```

precompiles/verifier/abi.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
"type": "bytes"
1616
},
1717
{
18-
"internalType": "bytes",
18+
"internalType": "bytes32",
1919
"name": "msg",
20-
"type": "bytes"
20+
"type": "bytes32"
2121
},
2222
{
2323
"internalType": "bytes",

precompiles/verifier/query.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ func (p Precompile) VerifyEd25519(
2424
return nil, fmt.Errorf("invalid pubKey type")
2525
}
2626

27-
msg, ok := args[1].([]byte)
27+
// Convert the message bytes to a bytes32 slice
28+
msgRaw, ok := args[1].([32]byte)
2829
if !ok {
2930
return nil, fmt.Errorf("invalid msg type")
3031
}
32+
msg := msgRaw[:]
3133

3234
signature, ok := args[2].([]byte)
3335
if !ok {

0 commit comments

Comments
 (0)