Skip to content

Commit

Permalink
Merge branch 'main' into owen/issues-2655/moveos_std_to_json
Browse files Browse the repository at this point in the history
  • Loading branch information
yubing744 authored Sep 21, 2024
2 parents 280347d + 621cef6 commit 2c14a07
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/deploy_mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,4 @@ jobs:
"cd /root/rooch && git fetch origin && git checkout -B $BRANCH origin/$BRANCH || git checkout $BRANCH && bash scripts/deploy_rooch_mainnet.sh \
'${{ env.REF }}' \
'${{ secrets.BTC_MAIN_RPC_URL }}' \
'${{ secrets.BTC_MAIN_RPC_PWD }}' \
'${{ secrets.OPENDA_GCP_MAINNET_BUCKET }}' \
'${{ secrets.OPENDA_GCP_MAINNET_CREDENTIAL }}'"
'${{ secrets.BTC_MAIN_RPC_PWD }}'"
18 changes: 8 additions & 10 deletions crates/rooch-proposer/src/scc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) RoochNetwork
// SPDX-License-Identifier: Apache-2.0

use std::collections::BTreeMap;

use crate::actor::messages::TransactionProposeMessage;
use moveos_types::h256;
use moveos_types::h256::H256;
Expand All @@ -14,7 +12,7 @@ use rooch_types::block::Block;
/// This SCC is a mirror of the on-chain SCC
pub struct StateCommitmentChain {
//TODO save to the storage
blocks: BTreeMap<u128, Block>,
last_block: Option<Block>,
buffer: Vec<TransactionProposeMessage>,
da: DAProxy,
}
Expand All @@ -23,7 +21,7 @@ impl StateCommitmentChain {
/// Create a new SCC
pub fn new(da_proxy: DAProxy) -> Self {
Self {
blocks: BTreeMap::new(),
last_block: None,
buffer: Vec::new(),
da: da_proxy,
}
Expand All @@ -33,19 +31,19 @@ impl StateCommitmentChain {
self.buffer.push(tx);
}

/// Append a new block to the SCC
fn append_block(&mut self, block: Block) {
self.blocks.insert(block.block_number, block);
/// Update last block of the SCC
fn update_last_block(&mut self, block: Block) {
self.last_block = Some(block);
}

/// Get the last block of the SCC
pub fn last_block(&self) -> Option<&Block> {
self.blocks.values().last()
self.last_block.as_ref()
}

/// Get the last block number of the SCC
pub fn last_block_number(&self) -> Option<u128> {
self.blocks.keys().last().copied()
self.last_block.as_ref().map(|block| block.block_number)
}

/// Trigger the proposer to propose a new block
Expand Down Expand Up @@ -104,7 +102,7 @@ impl StateCommitmentChain {
tx_accumulator_root,
state_roots,
);
self.append_block(new_block);
self.update_last_block(new_block);
self.buffer.clear();
self.last_block()
}
Expand Down
5 changes: 1 addition & 4 deletions scripts/deploy_rooch_mainnet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
REF="$1"
BTC_MAIN_RPC_URL="$2"
BTC_MAIN_RPC_PWD="$3"
OPENDA_GCP_MAINNET_BUCKET="$4"
OPENDA_GCP_MAINNET_CREDENTIAL="$5"

sleep 30
docker image prune -a -f
Expand All @@ -17,5 +15,4 @@ docker run -d --name rooch-mainnet --restart unless-stopped -v /data:/root -p 67
server start -n main \
--btc-rpc-url "$BTC_MAIN_RPC_URL" \
--btc-rpc-username rooch-main \
--btc-rpc-password "$BTC_MAIN_RPC_PWD" \
--da "{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"gcs\", \"config\": {\"bucket\": \"$OPENDA_GCP_MAINNET_BUCKET\", \"credential\": \"$OPENDA_GCP_MAINNET_CREDENTIAL\"}}}]}}"
--btc-rpc-password "$BTC_MAIN_RPC_PWD"

0 comments on commit 2c14a07

Please sign in to comment.