Code Monkey home page Code Monkey logo

piltover's Introduction

Check Workflow Status Build Workflow Status

Exploration_Team

Overview

Starknet Core Contract components in Cairo.

Repository architecture

The different tasks of the Starknet Core Contract are here mapped to what we can call an "Appchain" Core Contract.

The functionalities of the core contract are split over several components. Each component is usually placed into a directory, event if it is simple. Doing so allow a good separation of additional files that may be written in the context of a component.

Due to a limitation of starknet foundry, we can't declare a contract that is defined under the tests directory. For this reason, mock contract are defined in their respective component location. This is also a good way for the component write to illustrate the minimum required to use the component.

  • appchain.cairo: core contract of the appchain on Starknet.

  • config: base configuration for the core contract.

  • messaging: messaging between Appchain - Starknet.

Build

To build the project, run:

scarb build

Bindings (Rust)

To build/update the bindings, first build the contract with scarb.

Then, within the Rust project bindings/ run:

cargo build

Test

To test the project, run:

snforge test

Code style (cairo)

  • Use snake_case for module name and not PascalCase.

  • Don't import directly a function from a module.

// Prefer that:
let addr = starknet::contract_address_const::<0>();

// Instead of:
use starknet::contract_address_const;
let addr = contract_address_const::<0>();
  • Document functions inside the trait, and add details if needed in the implementation.

piltover's People

Contributors

akankshaattavar avatar akashneelesh avatar b-j-roberts avatar drspacemn avatar glihm avatar jimmyfate avatar keneepatel avatar tadev0 avatar thomas192 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

piltover's Issues

[feat] sepolia deployment

The idea of this PR is to implement the tooling around piltover to easily deploy the contract on Sepolia.

This includes:

  1. Compiling the contracts
  2. Deploying the contracts configured to interact with the herodotus verifier, list of deployments is here.
  3. Documenting this process to be easily repeatable by user.

To achieve this task, several options:

  1. Bash script with Starkli
  2. Starknet foundry scripting
  3. Rust program using starknet-rs

We could give a try to the option 2 even if it still experimental and the API may change in the future. @b-j-roberts @drspacemn @EvolveArt what do you think it's better?
If we go with 3, it could be a dedicated command line tool for piltover. But more stuff to maintain.

[bug] add from_address in func compute_message_hash_sn_to_appc

fn compute_message_hash_sn_to_appc(
nonce: felt252, to_address: ContractAddress, selector: felt252, payload: Span
) -> felt252
should be:
fn compute_message_hash_sn_to_appc(from_address: ContractAddress,
nonce: felt252, to_address: ContractAddress, selector: felt252, payload: Span
) -> felt252

nonce: felt252, to_address: ContractAddress, selector: felt252, payload: Span<felt252>

/// <https://github.com/starkware-libs/cairo-lang/blob/caba294d82eeeccc3d86a158adb8ba209bf2d8fc/src/starkware/starknet/solidity/StarknetMessaging.sol#L88>

https://github.com/starkware-libs/cairo-lang/blob/caba294d82eeeccc3d86a158adb8ba209bf2d8fc/src/starkware/starknet/solidity/StarknetMessaging.sol#L88
https://github.com/starkware-libs/cairo-lang/blob/caba294d82eeeccc3d86a158adb8ba209bf2d8fc/src/starkware/starknet/solidity/StarknetMessaging.sol#L97
uint256(msg.sender),
If this is an error, I will modify this bug.

[dev] Commitment Verification Trait

Piltover will call both is_valid on the verifier contract with the DA fact, and also verify_attestation on the blobstream contracts in order to ensure a valid state update.

Since blobstream is not the only means by which an appchain can prove it's data commitment this should be a generic trait that verifies its input with a verify_attestation call.

[feat] Fact Verification

Once Herodotus Verifier implements a fact registry implement the logic for verifying the Proving Fact sent in updateState and correlating logic.

Can mock or hardcode the information if blocked on the Herodotus Fact Registry

References

https://github.com/starkware-libs/cairo-lang/blob/ab6d079f0265f903630aac9287e93d9e7cfb6fcf/src/starkware/starknet/solidity/Starknet.sol#L303

Test state-diff pre-kzg:
https://github.com/keep-starknet-strange/snos/blob/main/tests/common/data/os_output.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.