Skip to content
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

draft version of bn265_algebra #1

Closed
wants to merge 43 commits into from
Closed

draft version of bn265_algebra #1

wants to merge 43 commits into from

Conversation

nanne007
Copy link
Collaborator

@nanne007 nanne007 commented Nov 30, 2023

Currently,all the natives(except hash_to_curve) now support bn254 structures.
docs and tests are still missing.
and the gas of bn254 algebra operations are wrong.
I have tried the doc in scripts/algebra-gas/README.md, but the results of bls12_381 are different from the existing ones.
so I think there may be some gaps here.

I draft the pr here to get comments from outside, so that I can continue to improve the code to make the pr acceptable by aptos.

gedigi and others added 19 commits November 28, 2023 19:58
* schedule_compute includes sys txns

* commit should discover system txns

* lint

* misc fix

* misc fix

* fmt
* [compiler v2] Reference safety analysis

This implements a first cut of reference safety analysis (aka borrow analysis):

- This implements the variation of the semantics which also the Move prover uses and which is alined with Rust. See also the discussion on Discord about this subject.
- There is also a new version of the live var analysis (forked from the previous generic one) which does a few things differently: it computes locations for used variables (closes aptos-labs#10718), as well as infers copies and moves in the bytecode assign instruction, which is essential for the reference safety.
- `copy x` and `move x` which had been more or less ignored until now is implemented up to referernce safety analysis.
- There are a few fixes around the codebase required to make this PR work. For instance, scoping of names in expression was wrong during bytecode generation,
- The implementation is fairly complete and passes all v1 compiler tests as verified by comparing the outputs. This is module the variation in semantics.

* Improved documentation comments, rebased.

* Some more documentation. Also removing unnecessary Index edge (its covered by Call).

* Addressing review comments

* Addressing reviewer comments, fixing tests.

* Fixing tests

* Reviewer comments and tests.
* add console.log to multisig_account example

* fixup

---------

Co-authored-by: 현수영 <[email protected]>
Co-authored-by: David Wolinsky <[email protected]>
Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.56 to 0.10.60.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](sfackler/rust-openssl@openssl-v0.10.56...openssl-v0.10.60)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
…#10929)

### Description

This should primarily help with debugging disaster scenarios.

Did some light refactoring for this. `BatchStore` now does purely local work; the previous remote work (along with other interfaces) is moved out to `BatchReader/BatchReaderImpl`.

### Test Plan

Existing tests.
Because this check usese pull request target trigger the concurrency was actually incorrect and causing jobs to get randomly canceled

Test Plan: there is unfortunately not really a great way to test pull_request_target because it runs off the main branch on the workflow
nanne007 added a commit to zkmove/halo2-verifier.move that referenced this pull request Nov 30, 2023
since zkmove/aptos-core#1 is done,
now we can adopt the bn254 in the aptos repo.
this pr does this.
I change the aptos depencency to the forked repo.
and to run the test of halo2-verifier, you need to compile a new `aptos`
cli from the `bn256` branch of
https://github.com/young-rocks/aptos-core.git until the code is merged
into aptos repo.

Signed-off-by: caojiafeng <[email protected]>
element
.serialize_uncompressed(&mut buf)
.map_err(|_e| abort_invariant_violated())?;
buf.reverse();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlike BSL12381Fq12LscLsb, here a reverse is needed? Let me double check.

Copy link
Collaborator Author

@nanne007 nanne007 Dec 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice catch! that's a bug! I may wrongly copy pasted from msb part.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed now.

@zjma
Copy link

zjma commented Nov 30, 2023

Awesome work! Took a super quick look, no major issue.

I can help the gas calibration later in the official PR.

@zjma
Copy link

zjma commented Nov 30, 2023

Can you try open an official PR against aptos-core/main branch? there we can run more tests.

vineethk and others added 6 commits November 30, 2023 17:01
add commands for delegation pool voting
correct link to point to delegated staking page
For files in developer-docs-site/docs/move/book/:

1. abilities.md - Replaced n with c_n.
2. abort-and-assert.md - Added "of" in sentence.
3. functions.md - Fixed example where function names can't start with
  underscore. Made various sentences read better.
4. integers.md - Replaced "oe" with "or".
5. structs-and-resources.md - The "d" returned is actually already d*d.
  Renamed "d" to "dist_squared_value".
  Replaced d*d with dist_squared_value.
6. tuples.md - Improved sentence readability.100000
7. unit-testing.md - Current default max instructions in aptos 2.3.1 is
  100000 from "aptos move test -h".
zekun000 and others added 15 commits December 1, 2023 12:31
We observe that in some cases, processing through all requests can take very long when we have to request for missing batches that are already garbage collected. This commit adds a flag to drop those pending requests.
* Update index.md

updated deprecation policy for legacy indexer

* Use admonition, use in-site links

---------

Co-authored-by: Daniel Porteous <[email protected]>
zjma and others added 3 commits December 4, 2023 11:17
* [feat][aptos-stdlib] crypto algebra bn254

Signed-off-by: caojiafeng <[email protected]>

* scripts: fix update_algebra_gas_params.py

Signed-off-by: caojiafeng <[email protected]>

* add bn254 to default features to make unit test pass

* fix a bug mentioned in the comments

* initial

* update

* initial gas param

* benches for fq and fq2

* it compiles

* gas script now also specifies quantity types

* update scripts

---------

Signed-off-by: caojiafeng <[email protected]>
Co-authored-by: caojiafeng <[email protected]>
@nanne007 nanne007 closed this Dec 4, 2023
nanne007 pushed a commit that referenced this pull request Mar 6, 2024
* jwk types update

* update

* update

* jwk txn and execution

* update

* fix dummy

* update

* update

* update

* update

* update

* update

* remove dummy txns

* check voting power than verify signature

* fix warnings

* update

* update QuorumCertifiedUpdate struct
nanne007 pushed a commit that referenced this pull request Mar 6, 2024
* types update from randomnet

* update

* lint

* lint
nanne007 pushed a commit that referenced this pull request Jun 6, 2024
…#12462)

* [compiler-v2] Making v2 the basis of the prover (step #1)

This adds the missing parts to let compiler v2 fully support the specification language, and switches the prover to use v2 as the basis for verification of v1 bytecode. There is one further step needed to run the prover also on the code generated by v2 but that one is smaller than here. Notice that with this, we are dogfooding the v2 compiler frontend in production with the Move prover. There is no switching back and forth, code for the v1 prover integration has been removed. In more detail this does the following:

- There are two new env processors, the spec_checker and the spec_rewriter:
    - `spec_checker` checks the correct use of Move functions in the specification language. Those functions must be 'pure' and not depend on state or use certain other constructs. The checker is to be run as part of the regular compiler chain.
    - `spec_rewriter` rewrites specification expressions by converting used Move functions into specification functions, and doing other transformations to lift a Move expression into the specification language. This is only run by the prover itself.
- Inlining has been extended to deal with specification constructs.
- To support the inlining refactoring and the new processors, a new module `rewrite_target` is introduced which allows to collect functions and specification elements in a program in a unified fashion, rewriting them, and writing back to the environment. This new data structure has been inspired by the current design of the inliner and naturally extends it.
- A lot of ugliness has been ripped out of the model builder infrastructure (e.g. `TryImplAsSpec` mode is gone, as this is now handled by the `spec_rewriter`). More should come in step #2.
- Multiple test cases have been added.
- The prover driver has been adapted to use the new components.

* Fixing some unit tests

* Making hopefully all tests pass:

- Adding tuple support to the specification language as they are created by the inliner.
- Fixing an issue in memory usage calculation
- Adding a flag `--aptos` to the prover command line for easier debugging, avoiding the CLI.

* Disabling a condition for CI because of timeout.

* Rebasing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.