Skip to content

Commit

Permalink
circuit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ladnir committed Apr 23, 2024
1 parent 9cb0089 commit 0d5cb49
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cryptoTools/Circuit/BetaCircuit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ namespace osuCrypto
if(out >= mWireCount)
throw std::runtime_error(LOCATION);

if (aIdx == bIdx)
throw std::runtime_error(LOCATION);
//if (aIdx == bIdx)
//throw std::runtime_error(LOCATION);
//std::cout << "add "<<mGates.size() << ": " << aIdx <<" "<< bIdx <<" " << gateToString(gt) << " " << out << std::endl;

auto
Expand Down
9 changes: 9 additions & 0 deletions cryptoTools/Circuit/MxBit.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ namespace osuCrypto
}

bool hasValue() const { return mVal != u64(-1); }

bool operator==(const Address& a) const
{
return mVal == a.mVal;
}
bool operator!=(const Address& a) const
{
return !(*this == a);
}
private:
u64 mVal = u64(-1);
};
Expand Down
2 changes: 0 additions & 2 deletions cryptoTools/Circuit/MxCircuit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ namespace osuCrypto
if (addressMap.hasMapping(idx))
{
auto outIdx = addressMap[idx];
if (outIdx == 131)
std::cout << "here" << std::endl;
}
switch (node.mType)
{
Expand Down
3 changes: 3 additions & 0 deletions cryptoTools/Circuit/MxCircuit.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ namespace osuCrypto

Bit addGate(OpType t, const Bit& a, const Bit& b)
{
//if (a.mAddress == b.mAddress && a.mAddress.hasValue())
// throw std::runtime_error("illegal to provide the same bit. " LOCATION);

Bit ret;
ret.mCir = this;
ret.mAddress = Address(mGates.size(), 0);
Expand Down

0 comments on commit 0d5cb49

Please sign in to comment.