Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ submit_devnet_state:
@cargo run --manifest-path core/Cargo.toml --release -- submit-state --devnet

submit_account:
@cargo run --manifest-path core/Cargo.toml --release -- submit-account ${PUBLIC_KEY} ${STATE_HASH}
@cargo run --manifest-path core/Cargo.toml --release -- submit-account $(PUBLIC_KEY) $(STATE_HASH)

gen_contract_abis:
forge build --root contract/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ This repo also includes example contracts that show how to interact with Aligned
- If you want the Bridge to use Mina Devnet then use a node that runs a Devnet instance corresponding to the commit `599a76d` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/599a76dd47be99183d2102d9eb93eda679dd46ec) or a newer one (e.g.: [this Docker image](https://console.cloud.google.com/gcr/images/o1labs-192920/GLOBAL/mina-daemon:3.0.1-compatible-599a76d-bullseye-devnet/details)). See [how to connect to Mina Devnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-devnet#docker) if you want to run an instance yourself.
- If you want the Bridge to use Mina Mainnet use a node that runs a Mainnet instance corresponding to the commit `65c84ad` [of the Mina repo](https://github.com/MinaProtocol/mina/tree/65c84adacd55272160d9f77c31063d94a942afb6) or a newer one (e.g.: [this Docker image](http://gcr.io/o1labs-192920/mina-daemon:3.0.1-beta1-sai-query-snarked-ledger-c439ce5-bullseye-mainnet)). See [how to connect to Mina Mainnet](https://docs.minaprotocol.com/node-operators/block-producer-node/connecting-to-the-network#docker) if you want to run an instance yourself.

Alternatively, you can try with mina public nodes:
- devnet: https://api.minascan.io/node/devnet/v1/graphql
- mainnet:https://api.minascan.io/node/mainnet/v1/graphql
Comment thread
MarcosNicolau marked this conversation as resolved.
Outdated

### Setup Aligned Devnet infrastructure locally

1. Start Docker
Expand Down
2 changes: 1 addition & 1 deletion contract/src/MinaAccountValidationExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ error MinaAccountProvingSystemIdIsNotValid(bytes32); // c1872967
/// NEVER use this contract in a production environment.
contract MinaAccountValidationExample {
/// @notice The commitment to Mina Account proving system ID.
bytes32 constant PROVING_SYSTEM_ID_COMM = 0xd0591206d9e81e07f4defc5327957173572bcd1bca7838caa7be39b0c12b1873;
bytes32 constant PROVING_SYSTEM_ID_COMM = 0xee2a4bc7db81da2b7164e56b3649b1e2a09c58c455b15dabddd9146c7582cebc;

struct AlignedArgs {
bytes32 proofCommitment;
Expand Down
22 changes: 6 additions & 16 deletions contract/src/MinaStateSettlementExample.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ error AccountIsNotValid(bytes32 accountIdHash);
/// NEVER use this contract in a production environment.
contract MinaStateSettlementExample {
/// @notice The commitment to Mina proving system ID.
bytes32 constant PROVING_SYSTEM_ID_COMM =
0xdbb8d0f4c497851a5043c6363657698cb1387682cac2f786c731f8936109d795;
bytes32 constant PROVING_SYSTEM_ID_COMM = 0xd0591206d9e81e07f4defc5327957173572bcd1bca7838caa7be39b0c12b1873;

/// @notice The length of the verified state chain (also called the bridge's transition
/// frontier) to store.
Expand All @@ -33,8 +32,7 @@ contract MinaStateSettlementExample {
/// @notice Reference to the AlignedLayerServiceManager contract.
AlignedLayerServiceManager aligned;

constructor(address payable _alignedServiceAddr, bytes32 _tipStateHash, bool _devnetFlag
) {
constructor(address payable _alignedServiceAddr, bytes32 _tipStateHash, bool _devnetFlag) {
aligned = AlignedLayerServiceManager(_alignedServiceAddr);
chainStateHashes[BRIDGE_TRANSITION_FRONTIER_LEN - 1] = _tipStateHash;
devnetFlag = _devnetFlag;
Expand All @@ -51,24 +49,19 @@ contract MinaStateSettlementExample {
}

/// @notice Returns the latest verified chain state hashes.
function getChainStateHashes() external view returns (bytes32[BRIDGE_TRANSITION_FRONTIER_LEN] memory)
{
function getChainStateHashes() external view returns (bytes32[BRIDGE_TRANSITION_FRONTIER_LEN] memory) {
return chainStateHashes;
}

/// @notice Returns the latest verified chain ledger hashes.
function getChainLedgerHashes() external view returns (bytes32[BRIDGE_TRANSITION_FRONTIER_LEN] memory)
{
function getChainLedgerHashes() external view returns (bytes32[BRIDGE_TRANSITION_FRONTIER_LEN] memory) {
return chainLedgerHashes;
}

/// @notice Returns true if this snarked ledger hash was bridged.
function isLedgerVerified(bytes32 ledgerHash) external view returns (bool) {
for (uint256 i = 0; i < BRIDGE_TRANSITION_FRONTIER_LEN; i++) {
if (
chainLedgerHashes[BRIDGE_TRANSITION_FRONTIER_LEN - 1 - i] ==
ledgerHash
) {
if (chainLedgerHashes[BRIDGE_TRANSITION_FRONTIER_LEN - 1 - i] == ledgerHash) {
return true;
}
}
Expand Down Expand Up @@ -129,10 +122,7 @@ contract MinaStateSettlementExample {
// the next BRIDGE_TRANSITION_FRONTIER_LEN sets of 32 bytes are state hashes.
let addr_states := add(pubInput, 65)
// the next BRIDGE_TRANSITION_FRONTIER_LEN sets of 32 bytes are ledger hashes.
let addr_ledgers := add(
addr_states,
mul(32, BRIDGE_TRANSITION_FRONTIER_LEN)
)
let addr_ledgers := add(addr_states, mul(32, BRIDGE_TRANSITION_FRONTIER_LEN))

for { let i := 0 } lt(i, BRIDGE_TRANSITION_FRONTIER_LEN) { i := add(i, 1) } {
sstore(slot_states, mload(addr_states))
Expand Down
110 changes: 96 additions & 14 deletions contract_deployer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contract_deployer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
mina_bridge_core = { path = "../core/" }
aligned-sdk = { git = "https://github.com/lambdaclass/aligned_layer.git", rev = "220546afa12c035a508529224f5148cd6af4ca78" }
aligned-sdk = { git = "https://github.com/yetanotherco/aligned_layer.git", rev = "11d1801a86bedb375c8ccdd0d77074a7134a7427" }
tokio = "1.39.1"
env_logger = "0.11.5"
bincode = "1.3.3"
Expand Down
2 changes: 1 addition & 1 deletion contract_deployer/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use aligned_sdk::core::types::Network;
use aligned_sdk::common::types::Network;
use log::{debug, error, info};
use mina_bridge_core::{
eth::{
Expand Down
Loading
Loading