Skip to content

Commit 141faae

Browse files
authored
revert: keep LeftPad exact-length guard (== size), not >= size
Reverts the accepted suggestion. returns an oversized array unchanged for value.Length > size, silently handing the rust sign-server a wrong-length key instead of the 32-byte scalar the contract requires — a silent contract violation worse than the BlockCopy throw it avoids. The over-length case is unreachable anyway (secp256k1 scalars are <=32 bytes; the bug this fixes was under-length). Restores the exact-length fast path.
1 parent 9c84b52 commit 141faae

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Explorer/Assets/DCL/Web3/Accounts/RustEthereumAccount.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public RustEthereumAccount(EthECKey key)
3434

3535
private static byte[] LeftPad(byte[] value, int size)
3636
{
37-
if (value.Length >= size)
37+
if (value.Length == size)
3838
return value;
3939

4040
// Fresh array: the input is cached inside EthECKey and must not be mutated.

0 commit comments

Comments
 (0)