Skip to content

Commit

Permalink
chore: Remove Ultra Grumpkin flavor (#2825)
Browse files Browse the repository at this point in the history
The Grumpkin flavor of Ultra Honk doesn't actually work over Grumpkin,
or use IPA, so I get rid of it since it has no reason to exist.
  • Loading branch information
codygunton authored and AztecBot committed Oct 13, 2023
1 parent 6bccad4 commit 6dc6057
Show file tree
Hide file tree
Showing 22 changed files with 5 additions and 473 deletions.
1 change: 0 additions & 1 deletion cpp/src/barretenberg/honk/composer/ultra_composer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ UltraVerifier_<Flavor> UltraComposer_<Flavor>::create_verifier(std::shared_ptr<I
}

template class UltraComposer_<honk::flavor::Ultra>;
template class UltraComposer_<honk::flavor::UltraGrumpkin>;
template class UltraComposer_<honk::flavor::GoblinUltra>;
} // namespace proof_system::honk
4 changes: 0 additions & 4 deletions cpp/src/barretenberg/honk/composer/ultra_composer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,8 @@ template <UltraFlavor Flavor> class UltraComposer_ {
};
};
extern template class UltraComposer_<honk::flavor::Ultra>;
// TODO: the UltraGrumpkin flavor still works on BN254 because plookup needs to be templated to be able to construct
// Grumpkin circuits.
extern template class UltraComposer_<honk::flavor::UltraGrumpkin>;
extern template class UltraComposer_<honk::flavor::GoblinUltra>;
// TODO(#532): this pattern is weird; is this not instantiating the templates?
using UltraComposer = UltraComposer_<honk::flavor::Ultra>;
using UltraGrumpkinComposer = UltraComposer_<honk::flavor::UltraGrumpkin>;
using GoblinUltraComposer = UltraComposer_<honk::flavor::GoblinUltra>;
} // namespace proof_system::honk
31 changes: 0 additions & 31 deletions cpp/src/barretenberg/honk/composer/ultra_composer.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,35 +922,4 @@ TEST_F(UltraHonkComposerTests, range_constraint_small_variable)
prove_and_verify(circuit_builder, composer, /*expected_result=*/true);
}

TEST(UltraGrumpkinHonkComposer, XorConstraint)
{
using fr = barretenberg::fr;
// NOTE: as a WIP, this test may not actually use the Grumpkin SRS (just the IPA PCS).

auto circuit_builder = proof_system::UltraCircuitBuilder();

uint32_t left_value = engine.get_random_uint32();
uint32_t right_value = engine.get_random_uint32();

fr left_witness_value = fr{ left_value, 0, 0, 0 }.to_montgomery_form();
fr right_witness_value = fr{ right_value, 0, 0, 0 }.to_montgomery_form();

uint32_t left_witness_index = circuit_builder.add_variable(left_witness_value);
uint32_t right_witness_index = circuit_builder.add_variable(right_witness_value);

uint32_t xor_result_expected = left_value ^ right_value;

const auto lookup_accumulators = plookup::get_lookup_accumulators(
plookup::MultiTableId::UINT32_XOR, left_witness_value, right_witness_value, true);
auto xor_result = lookup_accumulators[plookup::ColumnIdx::C3]
[0]; // The zeroth index in the 3rd column is the fully accumulated xor

EXPECT_EQ(xor_result, xor_result_expected);
circuit_builder.create_gates_from_plookup_accumulators(
plookup::MultiTableId::UINT32_XOR, lookup_accumulators, left_witness_index, right_witness_index);

barretenberg::srs::init_crs_factory("../srs_db/ignition");
auto composer = UltraGrumpkinComposer();
prove_and_verify(circuit_builder, composer, /*expected_result=*/true);
}
} // namespace test_ultra_honk_composer
406 changes: 0 additions & 406 deletions cpp/src/barretenberg/honk/flavor/ultra_grumpkin.hpp

This file was deleted.

1 change: 0 additions & 1 deletion cpp/src/barretenberg/honk/instance/prover_instance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ std::shared_ptr<typename Flavor::VerificationKey> ProverInstance_<Flavor>::compu
}

template class ProverInstance_<honk::flavor::Ultra>;
template class ProverInstance_<honk::flavor::UltraGrumpkin>;
template class ProverInstance_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
2 changes: 0 additions & 2 deletions cpp/src/barretenberg/honk/instance/prover_instance.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/proof_system/folding_result.hpp"
#include "barretenberg/proof_system/composer/composer_lib.hpp"
#include "barretenberg/proof_system/flavor/flavor.hpp"
Expand Down Expand Up @@ -96,7 +95,6 @@ template <class Flavor> class ProverInstance_ {
};

extern template class ProverInstance_<honk::flavor::Ultra>;
extern template class ProverInstance_<honk::flavor::UltraGrumpkin>;
extern template class ProverInstance_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ template <class Flavor> class InstanceTests : public testing::Test {
};
};

using FlavorTypes = testing::Types<flavor::Ultra, flavor::UltraGrumpkin, flavor::GoblinUltra>;
using FlavorTypes = testing::Types<flavor::Ultra, flavor::GoblinUltra>;
TYPED_TEST_SUITE(InstanceTests, FlavorTypes);

TYPED_TEST(InstanceTests, SortedListAccumulator)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ template <typename Flavor> plonk::proof& MergeProver_<Flavor>::construct_proof()
}

template class MergeProver_<honk::flavor::Ultra>;
template class MergeProver_<honk::flavor::UltraGrumpkin>;
template class MergeProver_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/pcs/claim.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
Expand Down Expand Up @@ -38,7 +37,6 @@ template <typename Flavor> class MergeProver_ {
};

extern template class MergeProver_<honk::flavor::Ultra>;
extern template class MergeProver_<honk::flavor::UltraGrumpkin>;
extern template class MergeProver_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ template <typename Flavor> bool MergeVerifier_<Flavor>::verify_proof(const plonk
}

template class MergeVerifier_<honk::flavor::Ultra>;
template class MergeVerifier_<honk::flavor::UltraGrumpkin>;
template class MergeVerifier_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/pcs/claim.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
Expand Down Expand Up @@ -36,7 +35,6 @@ template <typename Flavor> class MergeVerifier_ {
};

extern template class MergeVerifier_<honk::flavor::Ultra>;
extern template class MergeVerifier_<honk::flavor::UltraGrumpkin>;
extern template class MergeVerifier_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,5 @@ ProverFoldingResult<typename ProverInstances::Flavor> ProtoGalaxyProver_<ProverI
return res;
}
template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::Ultra, 2>>;
template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::UltraGrumpkin, 2>>;
template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::GoblinUltra, 2>>;
} // namespace proof_system::honk
2 changes: 0 additions & 2 deletions cpp/src/barretenberg/honk/proof_system/protogalaxy_prover.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/instance/instances.hpp"
#include "barretenberg/honk/proof_system/folding_result.hpp"
#include "barretenberg/proof_system/flavor/flavor.hpp"
Expand All @@ -26,6 +25,5 @@ template <class ProverInstances> class ProtoGalaxyProver_ {
};

extern template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::Ultra, 2>>;
extern template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::UltraGrumpkin, 2>>;
extern template class ProtoGalaxyProver_<ProverInstances_<honk::flavor::GoblinUltra, 2>>;
} // namespace proof_system::honk
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@ VerifierFoldingResult<typename VerifierInstances::Flavor> ProtoGalaxyVerifier_<
}

template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::Ultra, 2>>;
template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::UltraGrumpkin, 2>>;
template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::GoblinUltra, 2>>;
} // namespace proof_system::honk
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/instance/instances.hpp"
#include "barretenberg/honk/proof_system/folding_result.hpp"
#include "barretenberg/honk/transcript/transcript.hpp"
Expand All @@ -25,6 +24,5 @@ template <class VerifierInstances> class ProtoGalaxyVerifier_ {
};

extern template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::Ultra, 2>>;
extern template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::UltraGrumpkin, 2>>;
extern template class ProtoGalaxyVerifier_<VerifierInstances_<honk::flavor::GoblinUltra, 2>>;
} // namespace proof_system::honk
1 change: 0 additions & 1 deletion cpp/src/barretenberg/honk/proof_system/ultra_prover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ template <UltraFlavor Flavor> plonk::proof& UltraProver_<Flavor>::construct_proo
}

template class UltraProver_<honk::flavor::Ultra>;
template class UltraProver_<honk::flavor::UltraGrumpkin>;
template class UltraProver_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
2 changes: 0 additions & 2 deletions cpp/src/barretenberg/honk/proof_system/ultra_prover.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/instance/prover_instance.hpp"
#include "barretenberg/honk/pcs/zeromorph/zeromorph.hpp"
#include "barretenberg/honk/sumcheck/sumcheck_output.hpp"
Expand Down Expand Up @@ -56,7 +55,6 @@ template <UltraFlavor Flavor> class UltraProver_ {
};

extern template class UltraProver_<honk::flavor::Ultra>;
extern template class UltraProver_<honk::flavor::UltraGrumpkin>;
extern template class UltraProver_<honk::flavor::GoblinUltra>;

using UltraProver = UltraProver_<honk::flavor::Ultra>;
Expand Down
1 change: 0 additions & 1 deletion cpp/src/barretenberg/honk/proof_system/ultra_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ template <typename Flavor> bool UltraVerifier_<Flavor>::verify_proof(const plonk
}

template class UltraVerifier_<honk::flavor::Ultra>;
template class UltraVerifier_<honk::flavor::UltraGrumpkin>;
template class UltraVerifier_<honk::flavor::GoblinUltra>;

} // namespace proof_system::honk
2 changes: 0 additions & 2 deletions cpp/src/barretenberg/honk/proof_system/ultra_verifier.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/sumcheck/sumcheck.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"

Expand All @@ -28,7 +27,6 @@ template <typename Flavor> class UltraVerifier_ {
};

extern template class UltraVerifier_<honk::flavor::Ultra>;
extern template class UltraVerifier_<honk::flavor::UltraGrumpkin>;
extern template class UltraVerifier_<honk::flavor::GoblinUltra>;

using UltraVerifier = UltraVerifier_<honk::flavor::Ultra>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,5 @@ template <typename FF> class UltraCircuitBuilder_ : public CircuitBuilderBase<ar
bool check_circuit();
};
extern template class UltraCircuitBuilder_<barretenberg::fr>;
// TODO: template plookup to be able to be able to have UltraCircuitBuilder on Grumpkin
// extern template class UltraCircuitBuilder_<grumpkin::fr>;
using UltraCircuitBuilder = UltraCircuitBuilder_<barretenberg::fr>;
// using UltraGrumpkinCircuitBuilder = UltraCircuitBuilder_<grumpkin::fr>;
} // namespace proof_system
9 changes: 4 additions & 5 deletions cpp/src/barretenberg/proof_system/flavor/flavor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ namespace proof_system::honk::flavor {
class Standard;
class StandardGrumpkin;
class Ultra;
class UltraGrumpkin;
class ECCVM;
class ECCVMGrumpkin;
class GoblinUltra;
Expand Down Expand Up @@ -283,10 +282,10 @@ template <typename T>
concept IsPlonkFlavor = IsAnyOf<T, plonk::flavor::Standard, plonk::flavor::Ultra>;

template <typename T>
concept IsHonkFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::UltraGrumpkin, honk::flavor::GoblinUltra>;
concept IsHonkFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::GoblinUltra>;

template <typename T>
concept IsUltraFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::UltraGrumpkin, honk::flavor::GoblinUltra>;
concept IsUltraFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::GoblinUltra>;

template <typename T>
concept IsGoblinFlavor = IsAnyOf<T, honk::flavor::GoblinUltra,
Expand All @@ -299,9 +298,9 @@ concept IsRecursiveFlavor = IsAnyOf<T, honk::flavor::UltraRecursive_<UltraCircui
honk::flavor::GoblinUltraRecursive_<UltraCircuitBuilder>,
honk::flavor::GoblinUltraRecursive_<GoblinUltraCircuitBuilder>>;

template <typename T> concept IsGrumpkinFlavor = IsAnyOf<T, honk::flavor::UltraGrumpkin>;
template <typename T> concept IsGrumpkinFlavor = IsAnyOf<T, honk::flavor::ECCVMGrumpkin>;

template <typename T> concept UltraFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::UltraGrumpkin, honk::flavor::GoblinUltra>;
template <typename T> concept UltraFlavor = IsAnyOf<T, honk::flavor::Ultra, honk::flavor::GoblinUltra>;

template <typename T> concept ECCVMFlavor = IsAnyOf<T, honk::flavor::ECCVM, honk::flavor::ECCVMGrumpkin>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "barretenberg/honk/flavor/goblin_ultra.hpp"
#include "barretenberg/honk/flavor/goblin_ultra_recursive.hpp"
#include "barretenberg/honk/flavor/ultra.hpp"
#include "barretenberg/honk/flavor/ultra_grumpkin.hpp"
#include "barretenberg/honk/flavor/ultra_recursive.hpp"
#include "barretenberg/honk/sumcheck/sumcheck.hpp"
#include "barretenberg/plonk/proof_system/types/proof.hpp"
Expand Down

0 comments on commit 6dc6057

Please sign in to comment.