-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Transcript redesign #2668
Conversation
using enum instead of size in tuple
GroupElement->Commitment for commitment objects, some class restructuring
Benchmark resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Values are compared against data from master at commit L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
MiscellaneousTransaction sizes based on how many contracts are deployed in the tx.
|
} | ||
} | ||
|
||
static std::vector<uint8_t> serializeObj(TranscriptObjectType enum_type, void* obj_ptr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if its possible to replace the void* usage with a type safe union instead, something like:
#include <iostream>
#include <string>
#include <variant>
// Define a structure for each variant
// (The code already has this defined, see uint32_t, FF, Commitment, ...)
struct VariantOne {
int value;
};
struct VariantTwo {
std::string message;
};
// Define the enum as a variant of all of your structures
using TranscriptObjectTypes = std::variant<VariantOne, VariantTwo>;
// Function to handle both variants
void handleVariant(const TranscriptObjectTypes& object_types) {
std::visit([](auto&& arg) {
using T = std::decay_t<decltype(arg)>;
if constexpr (std::is_same_v<T, VariantOne>) {
std::cout << "Handling VariantOne: " << arg.value << std::endl;
}
else if constexpr (std::is_same_v<T, VariantTwo>) {
std::cout << "Handling VariantTwo: " << arg.message << std::endl;
}
}, object_types);
}
int main() {
TranscriptObjectTypes object_type = VariantOne{20694};
handleVariant(object_type);
object_type = VariantTwo{"Hello Rust!"};
handleVariant(object_type);
return 0;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may not be the best way to do it, just pointing out alternatives to void*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot to respond - thanks for the suggestion! certainly a better solution than void*, but I think msgpack solves these problems
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you elaborate how msgpack help this? I don't think msgpack should live at such a low level in the protocol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msgpack would help get rid of this ordered_objects
vector because it handles the serialization/deserialization part. The other use case for ordered_objects
was for determining whether the prover and verifier followed the specified ordering. This use case isn't that useful and is mostly for preventing implementation bugs in the prover/verifier that should be caught by other tests, so I think it's fine to not have that.
Replaced by #2937 |
Please provide a paragraph or two giving a summary of the change, including relevant motivation and context.
Checklist:
Remove the checklist to signal you've completed it. Enable auto-merge if the PR is ready to merge.