Skip to content

Commit

Permalink
soun synchro - polishing commitment
Browse files Browse the repository at this point in the history
  • Loading branch information
martawleklinska committed Aug 20, 2024
1 parent 522892e commit c730b79
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion zkmarek/video/slides/e4/commitment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def construct(self):
self.title_text = Text("Commitment scheme", font = PRIMARY_FONT, color = PRIMARY_COLOR, font_size=40).to_edge(UP)
self.commiter = ImageMobject("data/images/person_blue.png")
self.rectangle = Rectangle(height=1.5, width=4, color = PRIMARY_COLOR).next_to(self.commiter, LEFT, buff = 0.5)
self.commitment = Text("secret message", font = PRIMARY_FONT, color = PRIMARY_COLOR).scale(0.6).next_to(self.commiter, LEFT, buff = 0.6)
self.commitment = Text("secret message", font = PRIMARY_FONT, color = PRIMARY_COLOR).scale(0.6).next_to(self.commiter, LEFT, buff = 0.6).shift(LEFT)

self.lock = ImageMobject("data/images/Locked@2x.png").scale(0.25).next_to(self.commitment, RIGHT, buff = 0.1)
self.tex = Tex(load("zkmarek/video/slides/e4/properties.tex"), color=SECONDARY_COLOR)
Expand Down
27 changes: 17 additions & 10 deletions zkmarek/video/slides/e4/poly_commitment.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manim import LEFT, RIGHT, FadeIn, ImageMobject, Text, DOWN, UP, Write, MathTex, FadeOut, Indicate, ValueTracker, Create, TransformMatchingShapes, Unwrite
from manim import LEFT, RIGHT, FadeIn, ImageMobject, Text, DOWN, UP, Write, MathTex, FadeOut, Indicate, ValueTracker, Create, TransformMatchingShapes, Unwrite, MoveToTarget, VGroup

from zkmarek.video.constant import SECONDARY_COLOR, PRIMARY_FONT, PRIMARY_COLOR, HIGHLIGHT_COLOR
from zkmarek.video.slides.common.slide_base import SlideBase
Expand Down Expand Up @@ -35,9 +35,9 @@ def construct(self):
self.p_tau = DotOnCurve(self.chart.ax, r"({{\tau}}, {{?}})", a_tau)
self.p_tau.label.shift(DOWN*0.15+LEFT*0.15).scale(1.1)

self.trusted_setup = MathTex(r"{{\tau^1}} \cdot {{G_1}} + {{\tau^2}} \cdot {{G_1}} + {{\cdots}} + {{\tau^n}} \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0.3).shift(RIGHT*1.5)
self.trusted_setup1 = MathTex(r"\left[ {{\tau^1}} + {{\tau^2}} + {{\cdots}} + {{\tau^n}} \right] \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0.3).shift(RIGHT*1.5)
self.trusted_setup2 = MathTex(r"p({{\tau}}) \cdot{{G_1}} = \left[ {{\tau^1}} + {{\tau^2}} + {{\cdots}} + {{\tau^n}} \right] \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0.3).shift(RIGHT*1.5)
self.trusted_setup = MathTex(r"{{\tau^1}} \cdot {{G_1}} + {{\tau^2}} \cdot {{G_1}} + {{\cdots}} + {{\tau^n}} \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0).shift(RIGHT*1.5)
self.trusted_setup1 = MathTex(r"\left[ {{\tau^1}} + {{\tau^2}} + {{\cdots}} + {{\tau^n}} \right] \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0).shift(RIGHT*1.5)
self.trusted_setup2 = MathTex(r"p({{\tau}}) \cdot{{G_1}} = \left[ {{\tau^1}} + {{\tau^2}} + {{\cdots}} + {{\tau^n}} \right] \cdot {{G_1}} ", color = SECONDARY_COLOR).next_to(self.commiter_label, DOWN, buff = 0).shift(RIGHT*1.5)

self.opening = MathTex(r"p(z) = y", color = SECONDARY_COLOR).shift(2*UP)

Expand All @@ -51,11 +51,11 @@ def animate_in(self, scene):
scene.wait(1)
scene.play(FadeIn(self.verifier))
scene.play(Write(self.verifier_label))
scene.wait(1.5)
scene.wait(1)
scene.play(Indicate(self.chart.graph, color = HIGHLIGHT_COLOR))

self.new_subsection(scene, "committing", "data/sound/e4/slide3-2.mp3")
scene.wait(0.2)
scene.wait(1.2)
scene.play(Indicate(self.commiter, color = HIGHLIGHT_COLOR))
scene.wait(4)

Expand Down Expand Up @@ -84,7 +84,11 @@ def animate_in(self, scene):

self.new_subsection(scene, "trusted setup", "data/sound/e4/slide3-6.mp3")
scene.play(Unwrite(tau))
scene.wait(2)

self.images = VGroup(self.commiter, self.commiter_label, self.verifier, self.verifier_label)
self.images.generate_target()
self.images.target.shift(UP*1.5)
scene.play(MoveToTarget(self.images), run_time=2)
scene.play(FadeIn(self.trusted_setup))
scene.play(TransformMatchingShapes(self.trusted_setup, self.trusted_setup1))
scene.wait(2)
Expand All @@ -98,13 +102,16 @@ def animate_in(self, scene):
self.new_subsection(scene, "opening", "data/sound/e4/slide3-7.mp3")
scene.play(Create(self.p.dot))
scene.play(Write(self.p.label))
scene.play(FadeOut(self.commitment))
scene.wait(2)
scene.play(FadeOut(self.commitment, self.trusted_setup2))

self.images.generate_target()
self.images.target.shift(DOWN*1.5)
scene.play(MoveToTarget(self.images), run_time=2)
scene.play(TransformMatchingShapes(self.p.label.copy(), self.opening))

self.new_subsection(scene, "enough info", "data/sound/e4/slide3-8.mp3")
scene.wait(2)
scene.play(Indicate(self.verifier, color = HIGHLIGHT_COLOR))

scene.wait(3.5)
scene.play(Indicate(self.opening, color = HIGHLIGHT_COLOR), Indicate(self.p, color = HIGHLIGHT_COLOR))
scene.wait(2)
Expand Down
12 changes: 6 additions & 6 deletions zkmarek/video/slides/e4/polynomials.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def construct(self):
self.point.append(DotOnCurve(self.chart.ax, "", a))
self.polynomial_modulo = MathTex(r"P({{x}}) \mod \ p = 4 {{x^3}} - 8{{x^2}} - 17 {{x}} + 30 {{\mod \ p}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial_modulo5 = MathTex(r"P({{x}}) \mod \ 5 = 4 {{x^3}} - 8{{x^2}} - 17 {{x}} + 30 {{\mod \ 5}} {{}} {{}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial0_modulo5 = MathTex(r"P({{0}}) \rightarrow = 4\cdot {{0^3}} - 8\cdot{{0^2}} - 17\cdot {{0}} + 30 {{\mod \ 5}} {{= 30 \mod 5}} {{= 0}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial1_modulo5 = MathTex(r"P({{1}}) \rightarrow = 4\cdot {{1^3}} - 8\cdot{{1^2}} - 17\cdot {{1}} + 30 {{\mod \ 5}} {{= 9 \mod 5}} {{= 4}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial0_modulo5 = MathTex(r"P({{0}}) \rightarrow 4\cdot {{0^3}} - 8\cdot{{0^2}} - 17\cdot {{0}} + 30 {{\mod \ 5}} {{= 30 \mod 5}} {{= 0}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial1_modulo5 = MathTex(r"P({{1}}) \rightarrow 4\cdot {{1^3}} - 8\cdot{{1^2}} - 17\cdot {{1}} + 30 {{\mod \ 5}} {{= 9 \mod 5}} {{= 4}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)

self.polynomial_modulo23 = MathTex(r"P({{x}}) \mod \ 23 = 4 {{x^3}} - 8{{x^2}} - 17 {{x}} + 30 {{\mod \ 23}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
self.polynomial_modulo41 = MathTex(r"P({{x}}) \mod \ 41 = 4 {{x^3}} - 8{{x^2}} - 17 {{x}} + 30 {{\mod \ 41}}", color = PRIMARY_COLOR).scale(0.7).to_edge(DOWN)
Expand Down Expand Up @@ -230,7 +230,7 @@ def animate_in(self, scene):
scene.wait(2)
scene.play(Indicate(self.intersect_sub, color = HIGHLIGHT_COLOR, scale_factor=1.7))
self.polynomial.to_edge(DOWN).shift(LEFT*3).scale(0.7)
scene.play(FadeOut(self.line_subtract, self.minus, self.subtract_z, self.quotient_z), TransformMatchingShapes(self.polynomial_z, self.polynomial))
scene.play(FadeOut(self.line_subtract, self.minus, self.subtract_z, self.quotient_z, self.intersect_sub), TransformMatchingShapes(self.polynomial_z, self.polynomial))

self.new_subsection(scene, "finite fields", "data/sound/e4/slide1-6.mp3")
self.chart1.gen_points()
Expand Down Expand Up @@ -261,11 +261,11 @@ def animate_in(self, scene):
scene.wait(2)
scene.play(Create(self.p0), Create(self.p1), Create(self.p2), Create(self.p3))
scene.wait(0.5)
scene.play(ApplyWave(self.chart1.ax[0]), ApplyWave(self.chart1.ax[1]), DIRECTON=UP)
scene.play(ApplyWave(self.chart1.ax[0]), ApplyWave(self.chart1.ax[1]), TransformMatchingShapes(self.polynomial_modulo, self.polynomial_modulo5))

self.new_subsection(scene, "P(0)", "data/sound/e4/slide1-8.mp3")
scene.play(Indicate(self.p0, color = HIGHLIGHT_COLOR))
scene.play(TransformMatchingShapes(self.polynomial_modulo, self.polynomial0_modulo5), run_time=1.3)
scene.play(TransformMatchingShapes(self.polynomial_modulo5, self.polynomial0_modulo5), run_time=1.3)
scene.wait(0.6)
scene.play(Indicate(self.polynomial0_modulo5[11], color = HIGHLIGHT_COLOR))
scene.wait(0.5)
Expand All @@ -280,7 +280,7 @@ def animate_in(self, scene):
scene.wait(4)
scene.play(ApplyWave(self.chart1.ax[1], DIRECTION=UP))

top_val = MathTex(r"p-1", color = SECONDARY_COLOR).to_edge(UP+RIGHT).shift(DOWN+LEFT*2).scale(0.8)
top_val = MathTex(r"p-1", color = SECONDARY_COLOR).to_edge(UP+RIGHT).shift(DOWN*1.2+LEFT*3).scale(0.8)
scene.play(FadeIn(top_val))
self.chart1.animate_create_horizontal_line(
scene, 4, 0, 4
Expand Down
10 changes: 5 additions & 5 deletions zkmarek/video/slides/episode3/ceremony.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,15 +152,15 @@ def animate_miniature(self, scene):
self.three_dot.scale(0.65).next_to(self.tau_1, DOWN, buff = 0.4)
scene.play(Write(self.three_dot))
scene.play(Write(self.tau_k))
scene.play(Write(self.line0))
scene.play(Write(self.line1))
scene.play(Write(self.linei))
scene.play(Indicate(self.tau_0, color = HIGHLIGHT_COLOR), Indicate(self.tau_1, color = HIGHLIGHT_COLOR), Indicate(self.tau_k, color = HIGHLIGHT_COLOR))
scene.play(Write(self.line0), run_time=0.3)
scene.play(Write(self.line1), run_time=0.3)
scene.play(Write(self.linei), run_time=0.3)

scene.play(Write(self.tau_col))

scene.play(Indicate(self.tau_0, color = HIGHLIGHT_COLOR), Indicate(self.tau_1, color = HIGHLIGHT_COLOR), Indicate(self.tau_k, color = HIGHLIGHT_COLOR))

scene.wait(2)
scene.wait(1)
scene.play(FadeOut(self.person, self.person2, self.person3, self.tau_0, self.tau_1, self.tau_k, self.three_dot, text, rectangle, self.line0, self.line1, self.linei, self.tau_col))

def animate_out(self, scene):
Expand Down

0 comments on commit c730b79

Please sign in to comment.