Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
snark: Handle only expected exceptions
Browse files Browse the repository at this point in the history
Handle only expected exceptions around snark primitives precompiled, pass anything else higher.
  • Loading branch information
chfast committed Jun 12, 2017
1 parent 5b383c5 commit 98ba0fd
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions libdevcrypto/LibSnark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ pair<bool, bytes> dev::crypto::alt_bn128_pairing_product(dev::bytesConstRef _in)
}
catch (InvalidEncoding const&)
{
return {false, bytes{}};
}
catch (...)
{
cwarn << "Internal exception from libsnark. Forwarding as precompiled contract failure.";
// Signal the call failure for invalid input.
return {false, bytes{}};
}
}
Expand All @@ -184,12 +180,9 @@ pair<bool, bytes> dev::crypto::alt_bn128_G1_add(dev::bytesConstRef _in)
}
catch (InvalidEncoding const&)
{
// Signal the call failure for invalid input.
return {false, bytes{}};
}
catch (...)
{
cwarn << "Internal exception from libsnark. Forwarding as precompiled contract failure.";
}
return {false, bytes{}};
}

pair<bool, bytes> dev::crypto::alt_bn128_G1_mul(dev::bytesConstRef _in)
Expand All @@ -203,10 +196,7 @@ pair<bool, bytes> dev::crypto::alt_bn128_G1_mul(dev::bytesConstRef _in)
}
catch (InvalidEncoding const&)
{
// Signal the call failure for invalid input.
return {false, bytes{}};
}
catch (...)
{
cwarn << "Internal exception from libsnark. Forwarding as precompiled contract failure.";
}
return {false, bytes{}};
}

0 comments on commit 98ba0fd

Please sign in to comment.