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

Started README specification section #300

Merged
merged 16 commits into from
Jul 31, 2024
Merged

Started README specification section #300

merged 16 commits into from
Jul 31, 2024

Conversation

xqft
Copy link
Contributor

@xqft xqft commented Jul 26, 2024

No description provided.

@xqft xqft marked this pull request as ready for review July 30, 2024 19:25

If the Aligned Service Manager call returns true, this means that a Mina Proof of State of some candidate state (whose hash is known by the contract), checked against the Bridge’s tip state (consensus checking), was verified. Then this candidate state is now the tip state, and so its hash is stored in the contract.

Currently the cost of the “update tip” transaction is in between 100k and 150k gas, a big part of it being the calldata cost of sending both states data in the public inputs of the Mina Proof of State. The cost could be decreased to <100k by modifying the definition of a Mina Proof of State; sending the state data as proof data instead of public inputs. At the current phase of the project this is not a priority so this change wasn’t done yet.
Copy link
Collaborator

@gabrielbosio gabrielbosio Jul 31, 2024

Choose a reason for hiding this comment

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

This is important, I would title this Gas cost as part of the Smart Contract section.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! will add it

Copy link
Collaborator

@gabrielbosio gabrielbosio left a comment

Choose a reason for hiding this comment

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

Approved with a comment.

@gabrielbosio gabrielbosio merged commit fb383c7 into aligned Jul 31, 2024
3 checks passed
@gabrielbosio gabrielbosio deleted the specification branch July 31, 2024 19:15
gabrielbosio added a commit that referenced this pull request Oct 3, 2024
* Project cleanup (#287)

* Remove modules that won't be used in the Aligned version

* Fix Markdown lint issues

* Forward GraphQL port in CI

* Remove domain name usage

* Remove tunneling and comment Merkle path job

* Uncomment Merkle path job and comment nextest step

* Try port forwarding to access GraphQL

* Revert "Try port forwarding to access GraphQL"

This reverts commit 79084b9.

* Fetch Mina state hash and proof (#288)

* Remove modules that won't be used in the Aligned version

* Fix Markdown lint issues

* Forward GraphQL port in CI

* Remove domain name usage

* Remove tunneling and comment Merkle path job

* Uncomment Merkle path job and comment nextest step

* Try port forwarding to access GraphQL

* Revert "Try port forwarding to access GraphQL"

This reverts commit 79084b9.

* Fetch state hash and proof and parse them

* Simplify input parsing

* Revert "Simplify input parsing"

This reverts commit 91a1621.

* Separate queries for hash and proof

* Integrate with Aligned

* Add test

* Remove unwraps

* Add usage section

* Fetch last block from Mina (#291)

* Fetch last block and simplify polling

* Add public input generation

* Add integration test

* Read protocol state proof

* Remove unnecessary ignored file

* Use mina-builder as GraphQL server

* Add Polling service job

* Make test generate files in same dir

* Fix clippy issue

* Send hardcoded tip for consensus check (#292)

* Send hardocoded (for now) tip data

* Adapt to new state size

* State size in protocol state public input (#297)

* Add state size to public input

* Cast state len to u32

* Core program and Aligned polling serivce (#296)

* Renamed polling service to core

* Reorg core

* WIP aligned_polling_service

* Implemented submit function to aligned service

* Added tokio and called submit proof function

* Added dotenv and default values for some variables

* Added logging

* Fixed batcher address

* Better logging

* Update logs

* Update Makefile

* Update README

* Fix CI

* Smart contract (#295)

* chore: forge init

* forge install: forge-std

v1.9.1

* Contract baseline

* Rename files and contract

* forge install: aligned_layer

mina

* Fix remappings

* Fix versions and remappings

* First version of updateLastVerifiedState function

* Smart contract utility (#298)

* Create smart contract utility

* Add contract ABI

* WIP call contract

* Finish function to update smart contract

* WIP Deploy contract

* Finished bridge contract deployment

* WIP Hash public inputs

* Finished smart contract utility

* Remove unused env vars

* Fix mina bridge script

* Update readme

* Clarify Makefile comment

* Fix module doc

* Move smart contract update comment

* Update README.md

---------

Co-authored-by: Gabriel Bosio <[email protected]>

* Clean core (#301)

* Create smart contract utility

* Add contract ABI

* WIP call contract

* Finish function to update smart contract

* WIP Deploy contract

* Finished bridge contract deployment

* WIP Hash public inputs

* Finished smart contract utility

* Remove unused env vars

* Fix mina bridge script

* Update readme

* Clarify Makefile comment

* Fix module doc

* Move smart contract update comment

* Refactor constants into their own file

* Better logging

* Change variable name

* Change log

* Refactor environment variables

* Refactor env.rs and constants.rs into utils mod

* Refactor wallet setup

* Add missing env var

* Default env vars as constants

* Fix test

* Remove git diff marker

* Remove git diff marker

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Refactor closure

---------

Co-authored-by: Gabriel Bosio <[email protected]>

* Started README specification section (#300)

* Started README specification section

* Architecture updated

* Architecture links updated

* update Mina Polling Service Architecture

* Update specification

* README fixes

* Fix warning

* Fix usage section

* Update consensus checks

* Fix header

* Fix about

* Fix about

* Fix links

* Fix links

* Update README.md

---------

Co-authored-by: Eduardo Veralli <[email protected]>

* Verify account inclusion locally (#290)

* Remove modules that won't be used in the Aligned version

* Fix Markdown lint issues

* Forward GraphQL port in CI

* Remove domain name usage

* Remove tunneling and comment Merkle path job

* Uncomment Merkle path job and comment nextest step

* Try port forwarding to access GraphQL

* Revert "Try port forwarding to access GraphQL"

This reverts commit 79084b9.

* Fetch state hash and proof and parse them

* Simplify input parsing

* Revert "Simplify input parsing"

This reverts commit 91a1621.

* Separate queries for hash and proof

* Integrate with Aligned

* Add test

* Remove unwraps

* Add usage section

* Add initial SP1 project for account inclusion

* Simplify and add make cmd

* Match SP1 version with Aligned one

* Query and parse Merkle root

* Fix parser lockfile

* WIP Merkle path verification

* Query merkle root

* Verify merkle

* Moved query merkle root fn to test module

* Move merkle_path.rs to lib.rs

* Remove SP1 project, move tests crate out

* Small fixes

* Added query merkle root

* WIP get tip state hash

* Finished account inclusion

* Update contract names

* Update README.md

* Apply suggestions from code review

Co-authored-by: Gabriel Bosio <[email protected]>

* Add newline to .gitignore

---------

Co-authored-by: Estéfano Bargas <[email protected]>

* Refactor mina service to use `graphql_client` (#306)

* Remove modules that won't be used in the Aligned version

* Fix Markdown lint issues

* Forward GraphQL port in CI

* Remove domain name usage

* Remove tunneling and comment Merkle path job

* Uncomment Merkle path job and comment nextest step

* Try port forwarding to access GraphQL

* Revert "Try port forwarding to access GraphQL"

This reverts commit 79084b9.

* Fetch state hash and proof and parse them

* Simplify input parsing

* Revert "Simplify input parsing"

This reverts commit 91a1621.

* Separate queries for hash and proof

* Integrate with Aligned

* Add test

* Remove unwraps

* Add usage section

* Add initial SP1 project for account inclusion

* Simplify and add make cmd

* Match SP1 version with Aligned one

* Query and parse Merkle root

* Fix parser lockfile

* WIP

* WIP Merkle path verification

* Query merkle root

* Verify merkle

* Moved query merkle root fn to test module

* Move merkle_path.rs to lib.rs

* Remove SP1 project, move tests crate out

* Small fixes

* Added query merkle root

* WIP get tip state hash

* Finished account inclusion

* Update contract names

* WIP use graphql_client

* Fix and add debug comments

* Remove conflict

---------

Co-authored-by: gabrielbosio <[email protected]>

* Remove state_utility directory (#304)

* Add account inclusion job (#305)

Co-authored-by: Estéfano Bargas <[email protected]>

* Use tip state from bridge contract (#307)

* Remove modules that won't be used in the Aligned version

* Fix Markdown lint issues

* Forward GraphQL port in CI

* Remove domain name usage

* Remove tunneling and comment Merkle path job

* Uncomment Merkle path job and comment nextest step

* Try port forwarding to access GraphQL

* Revert "Try port forwarding to access GraphQL"

This reverts commit 79084b9.

* Fetch state hash and proof and parse them

* Simplify input parsing

* Revert "Simplify input parsing"

This reverts commit 91a1621.

* Separate queries for hash and proof

* Integrate with Aligned

* Add test

* Remove unwraps

* Add usage section

* Add initial SP1 project for account inclusion

* Simplify and add make cmd

* Match SP1 version with Aligned one

* Query and parse Merkle root

* Fix parser lockfile

* WIP

* WIP Merkle path verification

* Query merkle root

* Verify merkle

* Moved query merkle root fn to test module

* Move merkle_path.rs to lib.rs

* Remove SP1 project, move tests crate out

* Small fixes

* Added query merkle root

* WIP get tip state hash

* Finished account inclusion

* Update contract names

* WIP use graphql_client

* Fix and add debug comments

* Use tip state from bridge contract

* Fix bad candidate hash

* Fix test and remove unused functions

* Add tip hash check in contract

* Serialize hashes first in pub inputs

* Add option to save proof files

* Use root state as initial tip for bridge (#308)

* Add root state hash argument to contract and deploy it using ethers

* Add contract_deployer crate

* Added root query

* Deploy contract with root

* Deploy contract with alloy

* Fix aligned contract address

* Add abi gen to deploy contract make rule

* Fix clippy

* Add error message to test

* Remove test (for now we cant execute it until we have an integration test)

* Fix account inclusion test

* Fix account inclusion test

* Update .gitignore

* Ignore test

---------

Co-authored-by: gabrielbosio <[email protected]>

* Update Aligned SDK (#314)

* Update README.md (#313)

* Update README.md

* readme update

* Update readme file

* Update readme file Transition frontier

* Small fixes

* Update README.md

* Format

---------

Co-authored-by: Eduardo Veralli <[email protected]>
Co-authored-by: gabrielbosio <[email protected]>

* Remove root state hash, fix pub input hash variable (#320)

* Aligned Layer with Holesky (#303)

* Add Holesky vars

* Update Mina contract

* Make it work for Holesky

* Fix clippy issues

* Log verification time

* Add Holesky constants and update dependencies

* Update Holesky contract

* Add newline in gitignore

* Move proof generator addr to Aligned group

* Revert Aligned SM address in Forge script

This script will be removed in another PR because it was replaced
with the contract_deployer.

* Integrate private key and keystore with contract deployment

* Point aligned branch back to mina

* Update Mina Holesky contract

* Remove account inclusion crate's GraphQL query, improve mina_polling_service's one (#317)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Delete account_inclusion directory

* Update ci.yaml

* Delete nonce file on submit error (#325)

* Delete nonce file on submit error

* Update Holesky contract

* Account verifier (#322)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Removed account_inclusion crate

* Take into account mina account proofs

* Add CLI commands

* Implement submission code for account proof

* Add ledger hash to state verifier

* Add accountIdHash and account verification feature for smart contract

* Add eth call for update account

* Fix clippy

* Update makefile rules

* Update specification

* Added doc to smart contract

* Fix clippy

* Update README.md

* Update Makefile

* Fix aligned sdk git dependency

* Update cargo.lock

* Point Aligned back to Mina (#329)

* Relative finalization (#327)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Removed account_inclusion crate

* Take into account mina account proofs

* Add CLI commands

* Implement submission code for account proof

* Add ledger hash to state verifier

* Add accountIdHash and account verification feature for smart contract

* Add eth call for update account

* Fix clippy

* Update makefile rules

* Update specification

* Added doc to smart contract

* Fix clippy

* Update README.md

* Query candidate chain, use bincode

* Update Makefile

* Fix aligned sdk git dependency

* Update cargo.lock

* Define new state proof, serialize with bincode

* Change proof field types

* Refactor proof definition

* Add entire states to Mina state proof

* Change version of clap to work with aligned

* Fix tip state

* Change core crate name

* Make serialization mod public

* Add contract support for relative finalization

* Fixed smart contract update function

* Check state hashes

* Fix hash store

* Fix clippy

* Remove unnecessary match case

* Fix aligned-sdk dependency

* Remove account hashes from contract storage (#331)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Removed account_inclusion crate

* Take into account mina account proofs

* Add CLI commands

* Implement submission code for account proof

* Add ledger hash to state verifier

* Add accountIdHash and account verification feature for smart contract

* Add eth call for update account

* Fix clippy

* Update makefile rules

* Update specification

* Added doc to smart contract

* Fix clippy

* Update README.md

* Query candidate chain, use bincode

* Update Makefile

* Fix aligned sdk git dependency

* Update cargo.lock

* Define new state proof, serialize with bincode

* Change proof field types

* Refactor proof definition

* Add entire states to Mina state proof

* Change version of clap to work with aligned

* Fix tip state

* Change core crate name

* Make serialization mod public

* Add contract support for relative finalization

* Fixed smart contract update function

* Check state hashes

* Fix hash store

* Fix clippy

* Remove account hash from contract storage

* Fix clippy

* Use new GraphQL API for account inclusion (#332)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Removed account_inclusion crate

* Take into account mina account proofs

* Add CLI commands

* Implement submission code for account proof

* Add ledger hash to state verifier

* Add accountIdHash and account verification feature for smart contract

* Add eth call for update account

* Fix clippy

* Update makefile rules

* Update specification

* Added doc to smart contract

* Fix clippy

* Update README.md

* Query candidate chain, use bincode

* Update Makefile

* Fix aligned sdk git dependency

* Update cargo.lock

* Define new state proof, serialize with bincode

* Change proof field types

* Refactor proof definition

* Add entire states to Mina state proof

* Change version of clap to work with aligned

* Fix tip state

* Change core crate name

* Make serialization mod public

* Add contract support for relative finalization

* Fixed smart contract update function

* Check state hashes

* Fix hash store

* Fix clippy

* Remove account hash from contract storage

* Fix clippy

* New account proof WIP

* Finish new account proof

* Remove unused dependencies

* Add new schema

* Intergrate new account query schema

* Change mina proof to store account

* Replace ledger hash with Fp

* Update comment

* Fix variable name

* Change staged ledger hash to snarked

* Fix clippy

* Sync with Aligned 0.5 (#333)

* Update Aligned

* Make aligned SDK point to correct branch

* Fix wallet chain ID

* Update dependencies

* Make aligned SDK point to mina branch

* Sync with Aligned 0.5.2 (#335)

* Add Solidity-friendly account structure as public input for the account inclusion proof (#334)

* Added merkle query

* Rename query_and_serialize

* WIP merkle query

* Fix test

* WIP Account query

* Finished account query

* Fixed TokenId deserialization

* Remove account query

* Fix clippy

* Removed account_inclusion crate

* Take into account mina account proofs

* Add CLI commands

* Implement submission code for account proof

* Add ledger hash to state verifier

* Add accountIdHash and account verification feature for smart contract

* Add eth call for update account

* Fix clippy

* Update makefile rules

* Update specification

* Added doc to smart contract

* Fix clippy

* Update README.md

* Query candidate chain, use bincode

* Update Makefile

* Fix aligned sdk git dependency

* Update cargo.lock

* Define new state proof, serialize with bincode

* Change proof field types

* Refactor proof definition

* Add entire states to Mina state proof

* Change version of clap to work with aligned

* Fix tip state

* Change core crate name

* Make serialization mod public

* Add contract support for relative finalization

* Fixed smart contract update function

* Check state hashes

* Fix hash store

* Fix clippy

* Remove account hash from contract storage

* Fix clippy

* New account proof WIP

* Finish new account proof

* Remove unused dependencies

* Add new schema

* Intergrate new account query schema

* Change mina proof to store account

* Replace ledger hash with Fp

* Update comment

* Fix variable name

* Change staged ledger hash to snarked

* Fix clippy

* MinaAccountValidation lib

* Gen abi of new lib

* Add Mina account solidity struct

* Update contract

* Refactor serialization, add account conversion

* Doc

* Change mina account proof to use encoded account

* Readd mina account in proof

* Handle new proof in smart contract

* Fix contract

* Update Aligned to 0.6.0 (#336)

* Sync with Aligned 0.5.2

* Start updating Aligned to 0.6.0

* Fix Aligned version update

* Fix Aligned SDK dependency (#339)

Currently points to the `update_to_06` branch which no longer exists

* Point Aligned SDK to mina branch (#340)

* Point SDK to mina branch

* Point Aligned submodule to mina branch

* Update Aligned to 0.7.0 (#341)

* [WIP] Update Aligned to 0.7.0

We must wait until Aligned uploads the release for 0.7.0.

Once it's uploaded we need to add a batcher payment service arg
to the `updateChain` call in the Aligned polling service.

* Update Aligned to 0.7.0

* Update Aligned branch

* Update Aligned and Bridge contracts

* Update Aligned Foundry submodule

* Sudoku example app (#338)

* Init bun project

* Refactor

* chore: forge init

* forge install: forge-std

v1.9.2

* Rename Counter to Sudoku

* forge install: mina_bridge

132e4ea

* Contract mockup

* Add remappings, fix version

* Remove unused files, add contract constructor

* Remove mina_bridge submodule

* Rename zkapp

* Rename app to example

* forge install: forge-std

v1.9.2

* Created Rust app project

* zkApp script

* Fiz zkapp script

* Core refactor

* Add sdk

* Complete app

* Change zkapp address to constant

* Updated rust app

* Rename mina_contract to mina_zkapp

* Completed sudoku eth contract

* [WIP] Update Aligned to 0.7.0

We must wait until Aligned uploads the release for 0.7.0.

Once it's uploaded we need to add a batcher payment service arg
to the `updateChain` call in the Aligned polling service.

* Update Aligned to 0.7.0

* Update Aligned branch

* Finish sudoku contract deployer

* Rename sudoku contract

* Fix contract deployer

* Update Aligned and Bridge contracts

* Update Aligned Foundry submodule

* Add call to SudokuValidity, small fixes to contract

* Update makefile

* Add better log and getter function for timestamp

* Fix contract validateAccount call

* Add retrying logic for mina zkapp

* Fix Makefile

* Zkapp fixes

* Fix ledger hash search

* Add log

* Fix boolean comparison

* Add debug to query_candidate_chain()

* Update app

* Update to aligned 0.7

* Update constants

* Change zkapp config

* Fix clippy

* Add example diagram

---------

Co-authored-by: gabrielbosio <[email protected]>

* Rename MinaBridge to MinaStateSettlement (#345)

* Check Proving system ID (#342)

* [WIP] Update Aligned to 0.7.0

We must wait until Aligned uploads the release for 0.7.0.

Once it's uploaded we need to add a batcher payment service arg
to the `updateChain` call in the Aligned polling service.

* Update Aligned to 0.7.0

* Update Aligned branch

* Update Aligned and Bridge contracts

* Update Aligned Foundry submodule

* Add Proving system ID commitment check

* Update core lockfile

* Fix ABIs

* Remove unused Solidity error

* Update ABIs

* Parameterize Holesky contract addresses (#343)

* [WIP] Update Aligned to 0.7.0

We must wait until Aligned uploads the release for 0.7.0.

Once it's uploaded we need to add a batcher payment service arg
to the `updateChain` call in the Aligned polling service.

* Update Aligned to 0.7.0

* Update Aligned branch

* Update Aligned and Bridge contracts

* Update Aligned Foundry submodule

* Remove bridge addr constants and parameterize them

* Update README and code doc (#347)

* Fix state proof doc

* Fix account proof doc

* Update example

* Update README

* Update README'

* Add new specification

* Update table of contents

* Fix specification paragraph

* Add sdk docs

* Update use case readme

* Small changes

* Fix identation

* Fix identation

* Fix identation

* Modify top level desc

* Update config.json

* Update zkapp config

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

---------

Co-authored-by: Gabriel Bosio <[email protected]>

* Fix README links (#349)

* Fix Tock constraint domain size and add Book reference (#350)

* Fix (#353)

* Select Mina state proof source (#351)

* [WIP] Start adding devnet flag

* Add devnet flag

* Point SDK to Mina branch

* Lock SDK branch

* Fix settlement contract

* Parameterize state and account contract addresses

* Update example address and unwrap bridge addresses

* Update Aligned

* Reuse BATCHER_ETH_ADDR

* Point SDK to VK branch

* Replace aligned SM env var name with used in SDK

* Fix clippy

* Remove zkapp state logging

* Parameterize Sudoku Holesky address (#355)

* [WIP] Start adding devnet flag

* Add devnet flag

* Point SDK to Mina branch

* Lock SDK branch

* Fix settlement contract

* Parameterize state and account contract addresses

* Update example address and unwrap bridge addresses

* Update Aligned

* Reuse BATCHER_ETH_ADDR

* Point SDK to VK branch

* Replace aligned SM env var name with used in SDK

* Fix clippy

* Remove zkapp state logging

* Parameterize Sudoku Holesky address

* Usage and Setup sections (#348)

* Add details on usage section

* Start adding Ethereum testnet section

* Complete setup section

* Fix Mainnet image link

* Fix Aligned fork branch

* Add staking step in Testnet setup

* Complete Aligned Testnet setup

* Update README.md

* Revert "Update README.md"

This reverts commit 2f68a5d.

* Update submit state command

* Fix Testnet setup ordered list

* Update batcher deployment result paragraph

---------

Co-authored-by: Estéfano Bargas <[email protected]>

* Usage and setup changes (#354)

* Add details on usage section

* Start adding Ethereum testnet section

* Complete setup section

* Add step to deploy contracts

* Fix Mainnet image link

* Fix Aligned fork branch

* Add staking step in Testnet setup

* Complete Aligned Testnet setup

* Update README.md

* Revert "Update README.md"

This reverts commit 2f68a5d.

* Update README.md

* Update submit state command

* Fix Testnet setup ordered list

* Update batcher deployment result paragraph

---------

Co-authored-by: gabrielbosio <[email protected]>

* Remove duplicated section on README (#358)

* Update README (#357)

* Add details on usage section

* Start adding Ethereum testnet section

* Complete setup section

* Fix Mainnet image link

* Fix Aligned fork branch

* Add staking step in Testnet setup

* Complete Aligned Testnet setup

* Update README.md

* Revert "Update README.md"

This reverts commit 2f68a5d.

* Update submit state command

* Fix Testnet setup ordered list

* Update batcher deployment result paragraph

* Add initial disclaimer

* Qualify Bridge contracts

* Move table of contents up

* Fix headings identation

* Fix links in table of contents

* Remove div tag

* Update repo description

* Update README.md

Co-authored-by: Estéfano Bargas <[email protected]>

---------

Co-authored-by: Estéfano Bargas <[email protected]>

---------

Co-authored-by: Gabriel Bosio <[email protected]>
Co-authored-by: Eduardo Veralli <[email protected]>
Co-authored-by: gabrielbosio <[email protected]>
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.

2 participants