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

Consensus Integration #1467

Merged
merged 23 commits into from
Apr 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Imple execution state
  • Loading branch information
asonnino committed Apr 19, 2022
commit bcc50eafb5124741dba9e5f63a7e482ad054898a
18 changes: 11 additions & 7 deletions sui_core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use move_core_types::{
use move_vm_runtime::{move_vm::MoveVM, native_functions::NativeFunctionTable};
use narwhal_executor::{ExecutionIndices, ExecutionState};
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering;
use std::{
collections::{BTreeMap, HashMap, HashSet, VecDeque},
pin::Pin,
Expand Down Expand Up @@ -807,24 +808,27 @@ impl ModuleResolver for AuthorityState {

#[async_trait]
impl ExecutionState for AuthorityState {
type Transaction = String;
type Transaction = CertifiedTransaction;
type Error = SuiError;

async fn handle_consensus_transaction(
&self,
_execution_indices: ExecutionIndices,
_transaction: Self::Transaction,
execution_indices: ExecutionIndices,
transaction: Self::Transaction,
) -> Result<(), Self::Error> {
Ok(())
self.handle_consensus_certificate(transaction, execution_indices)
.await
}

fn ask_consensus_write_lock(&self) -> bool {
true
self.consensus_guardrail.fetch_add(1, Ordering::SeqCst) == 0
}

fn release_consensus_write_lock(&self) {}
fn release_consensus_write_lock(&self) {
self.consensus_guardrail.fetch_sub(0, Ordering::SeqCst);
}

async fn load_execution_indices(&self) -> Result<ExecutionIndices, Self::Error> {
Ok(ExecutionIndices::default())
self._database.last_consensus_index()
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename _database to database since its used now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is also an easy fix but it seems that many currently opened PR will have to rebase if I do it now. So I made an issue that I will quickly fix separately #1497

}
}
4 changes: 2 additions & 2 deletions sui_core/src/consensus_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use tokio::task::JoinHandle;
use tracing::debug;

#[cfg(test)]
#[path = "unit_tests/consensus_adapter_tests.rs"]
pub mod consensus_adapter_tests;
#[path = "unit_tests/consensus_tests.rs"]
pub mod consensus_tests;

/// A serialized consensus transaction.
type SerializedConsensusTransaction = Vec<u8>;
Expand Down
168 changes: 0 additions & 168 deletions sui_core/src/unit_tests/consensus_adapter_tests.rs

This file was deleted.

Loading