mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-20 23:19:49 +00:00
fix: complete fixes
This commit is contained in:
parent
b2ae6317d2
commit
6e61698ff8
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -158,7 +158,7 @@ jobs:
|
|||||||
|
|
||||||
valid-proof-test:
|
valid-proof-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
timeout-minutes: 60
|
timeout-minutes: 90
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
|
|||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3770,7 +3770,6 @@ dependencies = [
|
|||||||
"schemars 1.2.1",
|
"schemars 1.2.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_with",
|
"serde_with",
|
||||||
"sha2",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@ -19,12 +19,14 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView {
|
|||||||
let (type_name, type_class) = transaction_type_info(&transaction);
|
let (type_name, type_class) = transaction_type_info(&transaction);
|
||||||
|
|
||||||
// Get additional metadata based on transaction type
|
// Get additional metadata based on transaction type
|
||||||
let affected_pub_account_ids = transaction
|
|
||||||
.affected_public_account_ids();
|
|
||||||
|
|
||||||
let metadata = match &transaction {
|
let metadata = match &transaction {
|
||||||
Transaction::Public(_) => {
|
Transaction::Public(tx) => {
|
||||||
format!("{} accounts involved", affected_pub_account_ids.len())
|
let indexer_service_protocol::PublicTransaction {
|
||||||
|
hash: _,
|
||||||
|
message,
|
||||||
|
witness_set: _,
|
||||||
|
} = tx;
|
||||||
|
format!("{} accounts involved", message.account_ids.len())
|
||||||
}
|
}
|
||||||
Transaction::PrivacyPreserving(tx) => {
|
Transaction::PrivacyPreserving(tx) => {
|
||||||
let indexer_service_protocol::PrivacyPreservingTransaction {
|
let indexer_service_protocol::PrivacyPreservingTransaction {
|
||||||
@ -34,7 +36,7 @@ pub fn TransactionPreview(transaction: Transaction) -> impl IntoView {
|
|||||||
} = tx;
|
} = tx;
|
||||||
format!(
|
format!(
|
||||||
"{} public accounts, {} commitments",
|
"{} public accounts, {} commitments",
|
||||||
affected_pub_account_ids.len(),
|
message.public_account_ids.len(),
|
||||||
message.new_commitments.len()
|
message.new_commitments.len()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,7 +47,7 @@ pub fn MainPage() -> impl IntoView {
|
|||||||
Ok(last_id) => {
|
Ok(last_id) => {
|
||||||
api::get_blocks(
|
api::get_blocks(
|
||||||
std::cmp::max(last_id.saturating_sub(RECENT_BLOCKS_LIMIT) as u32, 1),
|
std::cmp::max(last_id.saturating_sub(RECENT_BLOCKS_LIMIT) as u32, 1),
|
||||||
RECENT_BLOCKS_LIMIT as u32,
|
(RECENT_BLOCKS_LIMIT + 1) as u32,
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,6 @@ pub fn TransactionPage() -> impl IntoView {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{
|
{
|
||||||
let affected_pub_acc_ids = tx.affected_public_account_ids();
|
|
||||||
match tx {
|
match tx {
|
||||||
Transaction::Public(ptx) => {
|
Transaction::Public(ptx) => {
|
||||||
let PublicTransaction {
|
let PublicTransaction {
|
||||||
@ -77,7 +76,7 @@ pub fn TransactionPage() -> impl IntoView {
|
|||||||
} = ptx;
|
} = ptx;
|
||||||
let PublicMessage {
|
let PublicMessage {
|
||||||
program_id,
|
program_id,
|
||||||
account_ids: _,
|
account_ids,
|
||||||
nonces,
|
nonces,
|
||||||
instruction_data,
|
instruction_data,
|
||||||
} = message;
|
} = message;
|
||||||
@ -116,7 +115,7 @@ pub fn TransactionPage() -> impl IntoView {
|
|||||||
|
|
||||||
<h3>"Accounts"</h3>
|
<h3>"Accounts"</h3>
|
||||||
<div class="accounts-list">
|
<div class="accounts-list">
|
||||||
{affected_pub_acc_ids
|
{account_ids
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip_longest(nonces.into_iter())
|
.zip_longest(nonces.into_iter())
|
||||||
.map(|maybe_pair| {
|
.map(|maybe_pair| {
|
||||||
@ -221,9 +220,11 @@ pub fn TransactionPage() -> impl IntoView {
|
|||||||
<div class="accounts-list">
|
<div class="accounts-list">
|
||||||
{public_account_ids
|
{public_account_ids
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip(nonces.into_iter())
|
.zip_longest(nonces.into_iter())
|
||||||
.map(|(account_id, nonce)| {
|
.map(|maybe_pair| {
|
||||||
let account_id_str = account_id.to_string();
|
match maybe_pair {
|
||||||
|
EitherOrBoth::Both(account_id, nonce) => {
|
||||||
|
let account_id_str = account_id.to_string();
|
||||||
view! {
|
view! {
|
||||||
<div class="account-item">
|
<div class="account-item">
|
||||||
<A href=format!("/account/{}", account_id_str)>
|
<A href=format!("/account/{}", account_id_str)>
|
||||||
@ -234,6 +235,33 @@ pub fn TransactionPage() -> impl IntoView {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
EitherOrBoth::Left(account_id) => {
|
||||||
|
let account_id_str = account_id.to_string();
|
||||||
|
view! {
|
||||||
|
<div class="account-item">
|
||||||
|
<A href=format!("/account/{}", account_id_str)>
|
||||||
|
<span class="hash">{account_id_str}</span>
|
||||||
|
</A>
|
||||||
|
<span class="nonce">
|
||||||
|
" (nonce: "{"Not affected by this transaction".to_string()}" )"
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EitherOrBoth::Right(_) => {
|
||||||
|
view! {
|
||||||
|
<div class="account-item">
|
||||||
|
<A href=format!("/account/{}", "Account not found")>
|
||||||
|
<span class="hash">{"Account not found"}</span>
|
||||||
|
</A>
|
||||||
|
<span class="nonce">
|
||||||
|
" (nonce: "{"Account not found".to_string()}" )"
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>()}
|
.collect::<Vec<_>>()}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
use std::{path::Path, sync::Arc};
|
use std::{path::Path, sync::Arc};
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use common::{block::Block, transaction::NSSATransaction};
|
use common::{
|
||||||
|
block::{BedrockStatus, Block},
|
||||||
|
transaction::NSSATransaction,
|
||||||
|
};
|
||||||
use nssa::{Account, AccountId, V02State};
|
use nssa::{Account, AccountId, V02State};
|
||||||
use storage::indexer::RocksDBIO;
|
use storage::indexer::RocksDBIO;
|
||||||
|
|
||||||
@ -92,7 +95,7 @@ impl IndexerStore {
|
|||||||
Ok(self.final_state()?.get_account_by_id(*account_id))
|
Ok(self.final_state()?.get_account_by_id(*account_id))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn put_block(&self, block: Block) -> Result<()> {
|
pub fn put_block(&self, mut block: Block) -> Result<()> {
|
||||||
let mut final_state = self.dbio.final_state()?;
|
let mut final_state = self.dbio.final_state()?;
|
||||||
|
|
||||||
for transaction in &block.body.transactions {
|
for transaction in &block.body.transactions {
|
||||||
@ -102,6 +105,11 @@ impl IndexerStore {
|
|||||||
.execute_check_on_state(&mut final_state)?;
|
.execute_check_on_state(&mut final_state)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToDo: Currently we are fetching only finalized blocks
|
||||||
|
// if it changes, the following lines need to be updated
|
||||||
|
// to represent correct block finality
|
||||||
|
block.bedrock_status = BedrockStatus::Finalized;
|
||||||
|
|
||||||
Ok(self.dbio.put_block(block)?)
|
Ok(self.dbio.put_block(block)?)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,6 @@ use crate::{block_store::IndexerStore, config::IndexerConfig};
|
|||||||
|
|
||||||
pub mod block_store;
|
pub mod block_store;
|
||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod state;
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct IndexerCore {
|
pub struct IndexerCore {
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use tokio::sync::RwLock;
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct IndexerState {
|
|
||||||
// Only one field for now, for testing.
|
|
||||||
pub latest_seen_block: Arc<RwLock<u64>>,
|
|
||||||
}
|
|
||||||
@ -16,7 +16,6 @@ base64.workspace = true
|
|||||||
base58.workspace = true
|
base58.workspace = true
|
||||||
hex.workspace = true
|
hex.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
sha2.workspace = true
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Enable conversion to/from NSSA core types
|
# Enable conversion to/from NSSA core types
|
||||||
|
|||||||
@ -3,14 +3,13 @@
|
|||||||
//! Currently it mostly mimics types from `nssa_core`, but it's important to have a separate crate
|
//! Currently it mostly mimics types from `nssa_core`, but it's important to have a separate crate
|
||||||
//! to define a stable interface for the indexer service RPCs which evolves in its own way.
|
//! to define a stable interface for the indexer service RPCs which evolves in its own way.
|
||||||
|
|
||||||
use std::{collections::HashSet, fmt::Display, str::FromStr};
|
use std::{fmt::Display, str::FromStr};
|
||||||
|
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use base58::{FromBase58 as _, ToBase58 as _};
|
use base58::{FromBase58 as _, ToBase58 as _};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_with::{DeserializeFromStr, SerializeDisplay};
|
use serde_with::{DeserializeFromStr, SerializeDisplay};
|
||||||
use sha2::{Digest, Sha256};
|
|
||||||
|
|
||||||
#[cfg(feature = "convert")]
|
#[cfg(feature = "convert")]
|
||||||
mod convert;
|
mod convert;
|
||||||
@ -54,18 +53,6 @@ pub struct AccountId {
|
|||||||
pub value: [u8; 32],
|
pub value: [u8; 32],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<&PublicKey> for AccountId {
|
|
||||||
fn from(key: &PublicKey) -> Self {
|
|
||||||
const PUBLIC_ACCOUNT_ID_PREFIX: &[u8; 32] =
|
|
||||||
b"/LEE/v0.3/AccountId/Public/\x00\x00\x00\x00\x00";
|
|
||||||
|
|
||||||
let mut hasher = Sha256::new();
|
|
||||||
hasher.update(PUBLIC_ACCOUNT_ID_PREFIX);
|
|
||||||
hasher.update(key.0);
|
|
||||||
Self{ value: hasher.finalize().into()}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Display for AccountId {
|
impl Display for AccountId {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
write!(f, "{}", self.value.to_base58())
|
write!(f, "{}", self.value.to_base58())
|
||||||
@ -161,15 +148,6 @@ impl Transaction {
|
|||||||
Transaction::ProgramDeployment(tx) => &tx.hash,
|
Transaction::ProgramDeployment(tx) => &tx.hash,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get affected public account ids
|
|
||||||
pub fn affected_public_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
match self {
|
|
||||||
Transaction::Public(tx) => tx.affected_public_account_ids(),
|
|
||||||
Transaction::PrivacyPreserving(tx) => tx.affected_public_account_ids(),
|
|
||||||
Transaction::ProgramDeployment(tx) => tx.affected_public_account_ids(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||||
@ -179,28 +157,6 @@ pub struct PublicTransaction {
|
|||||||
pub witness_set: WitnessSet,
|
pub witness_set: WitnessSet,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PublicTransaction {
|
|
||||||
|
|
||||||
|
|
||||||
pub(crate) fn signer_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
self.witness_set
|
|
||||||
.signatures_and_public_keys()
|
|
||||||
.iter()
|
|
||||||
.map(|(_, public_key)| AccountId::from(public_key))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn affected_public_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
let mut acc_set = self
|
|
||||||
.signer_account_ids()
|
|
||||||
.into_iter()
|
|
||||||
.collect::<HashSet<_>>();
|
|
||||||
acc_set.extend(&self.message.account_ids);
|
|
||||||
|
|
||||||
acc_set.into_iter().collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct PrivacyPreservingTransaction {
|
pub struct PrivacyPreservingTransaction {
|
||||||
pub hash: HashType,
|
pub hash: HashType,
|
||||||
@ -208,26 +164,6 @@ pub struct PrivacyPreservingTransaction {
|
|||||||
pub witness_set: WitnessSet,
|
pub witness_set: WitnessSet,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PrivacyPreservingTransaction {
|
|
||||||
pub(crate) fn signer_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
self.witness_set
|
|
||||||
.signatures_and_public_keys()
|
|
||||||
.iter()
|
|
||||||
.map(|(_, public_key)| AccountId::from(public_key))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn affected_public_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
let mut acc_set = self
|
|
||||||
.signer_account_ids()
|
|
||||||
.into_iter()
|
|
||||||
.collect::<HashSet<_>>();
|
|
||||||
acc_set.extend(&self.message.public_account_ids);
|
|
||||||
|
|
||||||
acc_set.into_iter().collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct PublicMessage {
|
pub struct PublicMessage {
|
||||||
pub program_id: ProgramId,
|
pub program_id: ProgramId,
|
||||||
@ -280,12 +216,6 @@ pub struct ProgramDeploymentTransaction {
|
|||||||
pub message: ProgramDeploymentMessage,
|
pub message: ProgramDeploymentMessage,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProgramDeploymentTransaction {
|
|
||||||
pub fn affected_public_account_ids(&self) -> Vec<AccountId> {
|
|
||||||
vec![]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub type ViewTag = u8;
|
pub type ViewTag = u8;
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user