diff --git a/block/internal/executing/executor.go b/block/internal/executing/executor.go index 00259b7050..2890615c07 100644 --- a/block/internal/executing/executor.go +++ b/block/internal/executing/executor.go @@ -149,7 +149,6 @@ func (e *Executor) Stop() error { func (e *Executor) GetLastState() types.State { state := e.getLastState() state.AppHash = bytes.Clone(state.AppHash) - state.LastResultsHash = bytes.Clone(state.LastResultsHash) return state } @@ -512,7 +511,6 @@ func (e *Executor) createBlock(ctx context.Context, height uint64, batchData *Ba Time: headerTime, }, LastHeaderHash: lastHeaderHash, - ConsensusHash: make(types.Hash, 32), AppHash: currentState.AppHash, ProposerAddress: e.genesis.ProposerAddress, ValidatorHash: validatorHash, diff --git a/block/internal/executing/executor_restart_test.go b/block/internal/executing/executor_restart_test.go index 88b3618e6c..3f0e8b500c 100644 --- a/block/internal/executing/executor_restart_test.go +++ b/block/internal/executing/executor_restart_test.go @@ -129,7 +129,6 @@ func TestExecutor_RestartUsesPendingHeader(t *testing.T) { Time: uint64(time.Now().UnixNano()), }, LastHeaderHash: originalHeader.Hash(), - ConsensusHash: make(types.Hash, 32), AppHash: currentState.AppHash, ProposerAddress: gen.ProposerAddress, ValidatorHash: validatorHash, diff --git a/block/internal/syncing/syncer.go b/block/internal/syncing/syncer.go index 0a9443c319..a8bebe8fa8 100644 --- a/block/internal/syncing/syncer.go +++ b/block/internal/syncing/syncer.go @@ -158,7 +158,6 @@ func (s *Syncer) GetLastState() types.State { stateCopy := *state stateCopy.AppHash = bytes.Clone(state.AppHash) - stateCopy.LastResultsHash = bytes.Clone(state.LastResultsHash) return stateCopy } diff --git a/client/crates/types/src/proto/evnode.v1.messages.rs b/client/crates/types/src/proto/evnode.v1.messages.rs index ecf6a5a289..b5b35c6fd8 100644 --- a/client/crates/types/src/proto/evnode.v1.messages.rs +++ b/client/crates/types/src/proto/evnode.v1.messages.rs @@ -24,10 +24,10 @@ pub struct GetPublicResponse { #[prost(bytes = "vec", tag = "1")] pub public_key: ::prost::alloc::vec::Vec, } -/// Version captures the consensus rules for processing a block in the blockchain, -/// including all blockchain data structures and the rules of the application's -/// state transition machine. -/// This is equivalent to the tmversion.Consensus type in Tendermint. +/// Version captures the consensus rules for processing a block in the +/// blockchain, including all blockchain data structures and the rules of the +/// application's state transition machine. This is equivalent to the +/// tmversion.Consensus type in Tendermint. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Version { @@ -52,23 +52,12 @@ pub struct Header { /// Previous block info #[prost(bytes = "vec", tag = "4")] pub last_header_hash: ::prost::alloc::vec::Vec, - /// Commit from aggregator(s) from the last block - #[prost(bytes = "vec", tag = "5")] - pub last_commit_hash: ::prost::alloc::vec::Vec, /// Block.Data root aka Transactions #[prost(bytes = "vec", tag = "6")] pub data_hash: ::prost::alloc::vec::Vec, - /// Consensus params for current block - #[prost(bytes = "vec", tag = "7")] - pub consensus_hash: ::prost::alloc::vec::Vec, /// State after applying txs from the current block #[prost(bytes = "vec", tag = "8")] pub app_hash: ::prost::alloc::vec::Vec, - /// Root hash of all results from the txs from the previous block. - /// This is ABCI specific but smart-contract chains require some way of committing - /// to transaction receipts/results. - #[prost(bytes = "vec", tag = "9")] - pub last_results_hash: ::prost::alloc::vec::Vec, /// Original proposer of the block /// Note that the address can be derived from the pubkey which can be derived /// from the signature when using secp256k. @@ -178,8 +167,6 @@ pub struct State { pub last_block_time: ::core::option::Option<::prost_types::Timestamp>, #[prost(uint64, tag = "6")] pub da_height: u64, - #[prost(bytes = "vec", tag = "7")] - pub last_results_hash: ::prost::alloc::vec::Vec, #[prost(bytes = "vec", tag = "8")] pub app_hash: ::prost::alloc::vec::Vec, } @@ -418,6 +405,13 @@ pub struct GetMetadataResponse { #[prost(bytes = "vec", tag = "1")] pub value: ::prost::alloc::vec::Vec, } +/// GetGenesisDaHeightResponse defines the DA height at which the first Evolve block was included. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetGenesisDaHeightResponse { + #[prost(uint64, tag = "3")] + pub height: u64, +} /// GetNamespaceResponse returns the namespace for this network #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/client/crates/types/src/proto/evnode.v1.services.rs b/client/crates/types/src/proto/evnode.v1.services.rs index 619d3406f9..7923876305 100644 --- a/client/crates/types/src/proto/evnode.v1.services.rs +++ b/client/crates/types/src/proto/evnode.v1.services.rs @@ -394,10 +394,10 @@ pub mod signer_service_server { const NAME: &'static str = "evnode.v1.SignerService"; } } -/// Version captures the consensus rules for processing a block in the blockchain, -/// including all blockchain data structures and the rules of the application's -/// state transition machine. -/// This is equivalent to the tmversion.Consensus type in Tendermint. +/// Version captures the consensus rules for processing a block in the +/// blockchain, including all blockchain data structures and the rules of the +/// application's state transition machine. This is equivalent to the +/// tmversion.Consensus type in Tendermint. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Version { @@ -422,23 +422,12 @@ pub struct Header { /// Previous block info #[prost(bytes = "vec", tag = "4")] pub last_header_hash: ::prost::alloc::vec::Vec, - /// Commit from aggregator(s) from the last block - #[prost(bytes = "vec", tag = "5")] - pub last_commit_hash: ::prost::alloc::vec::Vec, /// Block.Data root aka Transactions #[prost(bytes = "vec", tag = "6")] pub data_hash: ::prost::alloc::vec::Vec, - /// Consensus params for current block - #[prost(bytes = "vec", tag = "7")] - pub consensus_hash: ::prost::alloc::vec::Vec, /// State after applying txs from the current block #[prost(bytes = "vec", tag = "8")] pub app_hash: ::prost::alloc::vec::Vec, - /// Root hash of all results from the txs from the previous block. - /// This is ABCI specific but smart-contract chains require some way of committing - /// to transaction receipts/results. - #[prost(bytes = "vec", tag = "9")] - pub last_results_hash: ::prost::alloc::vec::Vec, /// Original proposer of the block /// Note that the address can be derived from the pubkey which can be derived /// from the signature when using secp256k. @@ -548,8 +537,6 @@ pub struct State { pub last_block_time: ::core::option::Option<::prost_types::Timestamp>, #[prost(uint64, tag = "6")] pub da_height: u64, - #[prost(bytes = "vec", tag = "7")] - pub last_results_hash: ::prost::alloc::vec::Vec, #[prost(bytes = "vec", tag = "8")] pub app_hash: ::prost::alloc::vec::Vec, } @@ -1978,6 +1965,13 @@ pub struct GetMetadataResponse { #[prost(bytes = "vec", tag = "1")] pub value: ::prost::alloc::vec::Vec, } +/// GetGenesisDaHeightResponse defines the DA height at which the first Evolve block was included. +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetGenesisDaHeightResponse { + #[prost(uint64, tag = "3")] + pub height: u64, +} /// Generated client implementations. pub mod store_service_client { #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] @@ -2142,6 +2136,32 @@ pub mod store_service_client { .insert(GrpcMethod::new("evnode.v1.StoreService", "GetMetadata")); self.inner.unary(req, path, codec).await } + /// GetGenesisDaHeight returns the DA height at which the first Evolve block was included. + pub async fn get_genesis_da_height( + &mut self, + request: impl tonic::IntoRequest<()>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::new( + tonic::Code::Unknown, + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic::codec::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/evnode.v1.StoreService/GetGenesisDaHeight", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert(GrpcMethod::new("evnode.v1.StoreService", "GetGenesisDaHeight")); + self.inner.unary(req, path, codec).await + } } } /// Generated server implementations. @@ -2175,6 +2195,14 @@ pub mod store_service_server { tonic::Response, tonic::Status, >; + /// GetGenesisDaHeight returns the DA height at which the first Evolve block was included. + async fn get_genesis_da_height( + &self, + request: tonic::Request<()>, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; } /// StoreService defines the RPC service for the store package #[derive(Debug)] @@ -2389,6 +2417,48 @@ pub mod store_service_server { }; Box::pin(fut) } + "/evnode.v1.StoreService/GetGenesisDaHeight" => { + #[allow(non_camel_case_types)] + struct GetGenesisDaHeightSvc(pub Arc); + impl tonic::server::UnaryService<()> + for GetGenesisDaHeightSvc { + type Response = super::GetGenesisDaHeightResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call(&mut self, request: tonic::Request<()>) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_genesis_da_height(&inner, request) + .await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let inner = inner.0; + let method = GetGenesisDaHeightSvc(inner); + let codec = tonic::codec::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } _ => { Box::pin(async move { Ok( @@ -2558,7 +2628,7 @@ pub mod config_service_client { .insert(GrpcMethod::new("evnode.v1.ConfigService", "GetNamespace")); self.inner.unary(req, path, codec).await } - /// GetSequencerInfo returns information about the sequencer + /// GetSignerInfo returns information about the signer pub async fn get_signer_info( &mut self, request: impl tonic::IntoRequest<()>, @@ -2601,7 +2671,7 @@ pub mod config_service_server { tonic::Response, tonic::Status, >; - /// GetSequencerInfo returns information about the sequencer + /// GetSignerInfo returns information about the signer async fn get_signer_info( &self, request: tonic::Request<()>, diff --git a/docs/adr/adr-004-core-types.md b/docs/adr/adr-004-core-types.md index ee4bf5e35f..bf2d5f2fa7 100644 --- a/docs/adr/adr-004-core-types.md +++ b/docs/adr/adr-004-core-types.md @@ -56,15 +56,9 @@ type Header struct { LastHeaderHash [32]byte // hashes of block data - LastCommitHash [32]byte // commit from aggregator(s) from the last block DataHash [32]byte // Block.Data root aka Transactions - ConsensusHash [32]byte // consensus params for current block AppHash [32]byte // state after applying txs from the current block - // root hash of all results from the txs from the previous block - // This is ABCI specific but smart-contract chains require some way of committing to transaction receipts/results. - LastResultsHash [32]byte - // Note that the address can be derived from the pubkey which can be derived // from the signature when using secp256k. diff --git a/docs/adr/adr-015-rollkit-minimal-header.md b/docs/adr/adr-015-rollkit-minimal-header.md index 1b7793f228..ac38def43e 100644 --- a/docs/adr/adr-015-rollkit-minimal-header.md +++ b/docs/adr/adr-015-rollkit-minimal-header.md @@ -106,14 +106,10 @@ This minimal Rollkit header can be transformed to be tailored to a specific exec This header can be transformed into an ABCI-specific header for IBC compatibility. - `Version`: Required by IBC clients to correctly interpret the block's structure and contents. -- `LastCommitHash`: The hash of the previous block's commit, used by IBC clients to verify the legitimacy of the block's state transitions. - `DataHash`: A hash of the block's transaction data, enabling IBC clients to verify that the data has not been tampered with. Can be constructed from unpacking the `DataCommitment` in Rollkit header. - `ValidatorHash`: Current validator set's hash, which IBC clients use to verify that the block was validated by the correct set of validators. This can be the IBC attester set of the chain for backward compatibility with the IBC Tendermint client, if needed. - `NextValidatorsHash`: The hash of the next validator set, allowing IBC clients to anticipate and verify upcoming validators. -- `ConsensusHash`: Denotes the hash of the consensus parameters, ensuring that IBC clients are aligned with the consensus rules of the blockchain. - `AppHash`: Same as the `StateRoot` in the Rollkit Header. -- `EvidenceHash`: A hash of evidence of any misbehavior by validators, which IBC clients use to assess the trustworthiness of the validator set. -- `LastResultsHash`: Root hash of all results from the transactions from the previous block. - `ProposerAddress`: The address of the block proposer, allowing IBC clients to track and verify the entities proposing new blocks. Can be constructed from the `extraData` field in the Rollkit Header. #### Transformation to ABCI Header @@ -139,18 +135,10 @@ This header can be transformed into an ABCI-specific header for IBC compatibilit ├─────────────────────┼───────────────────────┤ │ Version │ Added for IBC │ ├─────────────────────┼───────────────────────┤ -│ LastCommitHash │ Added for IBC │ -├─────────────────────┼───────────────────────┤ │ ValidatorHash │ Added for IBC │ ├─────────────────────┼───────────────────────┤ │ NextValidatorsHash │ Added for IBC │ ├─────────────────────┼───────────────────────┤ -│ ConsensusHash │ Added for IBC │ -├─────────────────────┼───────────────────────┤ -│ EvidenceHash │ Added for IBC │ -├─────────────────────┼───────────────────────┤ -│ LastResultsHash │ Added for IBC │ -├─────────────────────┼───────────────────────┤ │ ProposerAddress │ From ExtraData │ └─────────────────────┴───────────────────────┘ ``` diff --git a/docs/learn/specs/block-validity.md b/docs/learn/specs/block-validity.md index a66f59681d..6bd6964a5b 100644 --- a/docs/learn/specs/block-validity.md +++ b/docs/learn/specs/block-validity.md @@ -78,8 +78,6 @@ SignedHeader.Verify(untrustedHeader *SignedHeader) return error "headers are not adjacent" // Verify the link to previous header verify untrustedHeader.LastHeaderHash == h.Header.Hash() - // Verify LastCommit hash matches previous signature - verify untrustedHeader.LastCommitHash == sh.Signature.GetCommitHash(...) // Note: ValidatorHash field exists for compatibility but is not validated ``` @@ -112,11 +110,8 @@ SignedHeader.Verify(untrustedHeader *SignedHeader) | **Header** . | | | | Version | unused | | | LastHeaderHash | The hash of the previous accepted block | checked in the `Verify()`` step | -| LastCommitHash | The hash of the previous accepted block's commit | checked in the `Verify()`` step | | DataHash | Correct hash of the block's Data field | checked in the `ValidateBasic()`` step | -| ConsensusHash | unused | | | AppHash | The correct state root after executing the block's transactions against the accepted state | checked during block execution | -| LastResultsHash | Correct results from executing transactions | checked during block execution | | ProposerAddress | Address of the expected proposer | Must match Signer.Address in SignedHeader | | ValidatorHash | Compatibility field for Tendermint light client | Not validated | diff --git a/docs/src/openapi-rpc.json b/docs/src/openapi-rpc.json index 52e53e0739..e8fd381ed6 100644 --- a/docs/src/openapi-rpc.json +++ b/docs/src/openapi-rpc.json @@ -781,31 +781,16 @@ "format": "byte", "description": "Previous block info (base64-encoded)" }, - "last_commit_hash": { - "type": "string", - "format": "byte", - "description": "Commit from aggregator(s) from the last block (base64-encoded)" - }, "data_hash": { "type": "string", "format": "byte", "description": "Block.Data root aka Transactions (base64-encoded)" }, - "consensus_hash": { - "type": "string", - "format": "byte", - "description": "Consensus params for current block (base64-encoded)" - }, "app_hash": { "type": "string", "format": "byte", "description": "State after applying txs from the current block (base64-encoded)" }, - "last_results_hash": { - "type": "string", - "format": "byte", - "description": "Root hash of all results from the txs from the previous block (base64-encoded)" - }, "proposer_address": { "type": "string", "format": "byte", @@ -949,11 +934,6 @@ "format": "int64", "description": "Data availability height" }, - "last_results_hash": { - "type": "string", - "format": "byte", - "description": "Last results hash (base64-encoded)" - }, "app_hash": { "type": "string", "format": "byte", diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 290994be33..a38f1e802b 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -137,7 +137,6 @@ func (s *StoreServer) GetState( LastBlockHeight: state.LastBlockHeight, LastBlockTime: timestamppb.New(state.LastBlockTime), DaHeight: state.DAHeight, - LastResultsHash: state.LastResultsHash, ChainId: state.ChainID, Version: &pb.Version{ Block: state.Version.Block, diff --git a/proto/evnode/v1/evnode.proto b/proto/evnode/v1/evnode.proto index f1ca34ae7d..1cb3e23ea1 100644 --- a/proto/evnode/v1/evnode.proto +++ b/proto/evnode/v1/evnode.proto @@ -5,65 +5,48 @@ import "google/protobuf/timestamp.proto"; option go_package = "github.com/evstack/ev-node/types/pb/evnode/v1"; -// Version captures the consensus rules for processing a block in the blockchain, -// including all blockchain data structures and the rules of the application's -// state transition machine. -// This is equivalent to the tmversion.Consensus type in Tendermint. +// Version captures the consensus rules for processing a block in the +// blockchain, including all blockchain data structures and the rules of the +// application's state transition machine. This is equivalent to the +// tmversion.Consensus type in Tendermint. message Version { uint64 block = 1; - uint64 app = 2; + uint64 app = 2; } // Header is the header of a block in the blockchain. message Header { // Block and App version Version version = 1; - // Block height uint64 height = 2; - // Block creation time uint64 time = 3; - // Previous block info bytes last_header_hash = 4; - - // Commit from aggregator(s) from the last block - bytes last_commit_hash = 5; - // Block.Data root aka Transactions bytes data_hash = 6; - - // Consensus params for current block - bytes consensus_hash = 7; - // State after applying txs from the current block bytes app_hash = 8; - - // Root hash of all results from the txs from the previous block. - // This is ABCI specific but smart-contract chains require some way of committing - // to transaction receipts/results. - bytes last_results_hash = 9; - // Original proposer of the block // Note that the address can be derived from the pubkey which can be derived // from the signature when using secp256k. // We keep this in case users choose another signature format where the // pubkey can't be recovered by the signature (e.g. ed25519). bytes proposer_address = 10; - // validatorhash for compatibility with tendermint light client. bytes validator_hash = 11; - // Chain ID the block belongs to string chain_id = 12; + + reserved 5, 7, 9; } // SignedHeader is a header with a signature and a signer. message SignedHeader { - Header header = 1; - bytes signature = 2; - Signer signer = 3; + Header header = 1; + bytes signature = 2; + Signer signer = 3; } // Signer is a signer of a block in the blockchain. @@ -78,28 +61,25 @@ message Signer { message Metadata { // chain id string chain_id = 1; - // Block height uint64 height = 2; - // Block creation time uint64 time = 3; - // Previous block info bytes last_data_hash = 4; } // Data is the data of a block in the blockchain. message Data { - Metadata metadata = 1; - repeated bytes txs = 2; + Metadata metadata = 1; + repeated bytes txs = 2; } // SignedData is a data with a signature and a signer. message SignedData { - Data data = 1; - bytes signature = 2; - Signer signer = 3; + Data data = 1; + bytes signature = 2; + Signer signer = 3; } // Vote is a vote for a block in the blockchain. diff --git a/proto/evnode/v1/state.proto b/proto/evnode/v1/state.proto index 11af7f0cf3..5deab3fccd 100644 --- a/proto/evnode/v1/state.proto +++ b/proto/evnode/v1/state.proto @@ -8,12 +8,13 @@ option go_package = "github.com/evstack/ev-node/types/pb/evnode/v1"; // State is the state of the blockchain. message State { - evnode.v1.Version version = 1; - string chain_id = 2; - uint64 initial_height = 3; - uint64 last_block_height = 4; - google.protobuf.Timestamp last_block_time = 5; - uint64 da_height = 6; - bytes last_results_hash = 7; - bytes app_hash = 8; + evnode.v1.Version version = 1; + string chain_id = 2; + uint64 initial_height = 3; + uint64 last_block_height = 4; + google.protobuf.Timestamp last_block_time = 5; + uint64 da_height = 6; + bytes app_hash = 8; + + reserved 7; } diff --git a/tools/blob-decoder/main.go b/tools/blob-decoder/main.go index 4e59182d2a..ea54a7c737 100644 --- a/tools/blob-decoder/main.go +++ b/tools/blob-decoder/main.go @@ -212,13 +212,10 @@ func tryDecodeHeader(data []byte) interface{} { }, // Hash fields (convert [32]byte arrays to hex strings) - "lastHeaderHash": bytesToHex(signedHeader.LastHeaderHash[:]), - "lastCommitHash": bytesToHex(signedHeader.LastCommitHash[:]), - "dataHash": bytesToHex(signedHeader.DataHash[:]), - "consensusHash": bytesToHex(signedHeader.ConsensusHash[:]), - "appHash": bytesToHex(signedHeader.AppHash[:]), - "lastResultsHash": bytesToHex(signedHeader.LastResultsHash[:]), - "validatorHash": bytesToHex(signedHeader.ValidatorHash[:]), + "lastHeaderHash": bytesToHex(signedHeader.LastHeaderHash[:]), + "dataHash": bytesToHex(signedHeader.DataHash[:]), + "appHash": bytesToHex(signedHeader.AppHash[:]), + "validatorHash": bytesToHex(signedHeader.ValidatorHash[:]), // Proposer "proposerAddress": bytesToHex(signedHeader.ProposerAddress), diff --git a/tools/blob-decoder/templates/index.html b/tools/blob-decoder/templates/index.html index cc289ea5c0..799bce2d03 100644 --- a/tools/blob-decoder/templates/index.html +++ b/tools/blob-decoder/templates/index.html @@ -692,26 +692,14 @@

Input Blob Data

Last Header Hash: ${data.lastHeaderHash || "empty"} -
- Last Commit Hash: - ${data.lastCommitHash || "empty"} -
Data Hash: ${data.dataHash || "empty"}
-
- Consensus Hash: - ${data.consensusHash || "empty"} -
App Hash: ${data.appHash || "empty"}
-
- Last Results Hash: - ${data.lastResultsHash || "empty"} -
Validator Hash: ${data.validatorHash || "empty"} diff --git a/tools/da-debug/main.go b/tools/da-debug/main.go index ab7424a6e0..47b7e05e3f 100644 --- a/tools/da-debug/main.go +++ b/tools/da-debug/main.go @@ -370,11 +370,7 @@ func displayHeader(header *types.SignedHeader) { fmt.Printf("Chain ID: %s\n", header.ChainID()) fmt.Printf("Version: Block=%d, App=%d\n", header.Version.Block, header.Version.App) fmt.Printf("Last Header: %s\n", formatHashField(hex.EncodeToString(header.LastHeaderHash[:]))) - fmt.Printf("Last Commit: %s\n", formatHashField(hex.EncodeToString(header.LastCommitHash[:]))) fmt.Printf("Data Hash: %s\n", formatHashField(hex.EncodeToString(header.DataHash[:]))) - fmt.Printf("Consensus: %s\n", formatHashField(hex.EncodeToString(header.ConsensusHash[:]))) - fmt.Printf("App Hash: %s\n", formatHashField(hex.EncodeToString(header.AppHash[:]))) - fmt.Printf("Last Results: %s\n", formatHashField(hex.EncodeToString(header.LastResultsHash[:]))) fmt.Printf("Validator: %s\n", formatHashField(hex.EncodeToString(header.ValidatorHash[:]))) fmt.Printf("Proposer: %s\n", formatHashField(hex.EncodeToString(header.ProposerAddress))) fmt.Printf("Signature: %s\n", formatHashField(hex.EncodeToString(header.Signature))) diff --git a/types/CLAUDE.md b/types/CLAUDE.md index d056f48bf3..9cd5496e56 100644 --- a/types/CLAUDE.md +++ b/types/CLAUDE.md @@ -48,7 +48,6 @@ The types package defines the core data structures and types used throughout ev- - State transitions - DA height tracking - App hash management - - Results hash tracking - **Important**: Block version is set to 11 for CometBFT/IBC compatibility ### Transactions (`tx.go`) diff --git a/types/header.go b/types/header.go index 845cfc649f..04c3f8eb24 100644 --- a/types/header.go +++ b/types/header.go @@ -57,15 +57,8 @@ type Header struct { LastHeaderHash Hash // hashes of block data - LastCommitHash Hash // commit from aggregator(s) from the last block - DataHash Hash // Block.Data root aka Transactions - ConsensusHash Hash // consensus params for current block - AppHash Hash // state after applying txs from the current block - - // Root hash of all results from the txs from the previous block. - // This is ABCI specific but smart-contract chains require some way of committing - // to transaction receipts/results. - LastResultsHash Hash + DataHash Hash // Block.Data root aka Transactions + AppHash Hash // state after applying txs from the current block // compatibility with tendermint light client ValidatorHash Hash diff --git a/types/pb/evnode/v1/batch.pb.go b/types/pb/evnode/v1/batch.pb.go index 77b26c00a6..576f1edfcc 100644 --- a/types/pb/evnode/v1/batch.pb.go +++ b/types/pb/evnode/v1/batch.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/batch.proto diff --git a/types/pb/evnode/v1/config.pb.go b/types/pb/evnode/v1/config.pb.go index 1cab00fd1b..23eb58d56a 100644 --- a/types/pb/evnode/v1/config.pb.go +++ b/types/pb/evnode/v1/config.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/config.proto diff --git a/types/pb/evnode/v1/evnode.pb.go b/types/pb/evnode/v1/evnode.pb.go index 700b2182ef..7c532c7c7e 100644 --- a/types/pb/evnode/v1/evnode.pb.go +++ b/types/pb/evnode/v1/evnode.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/evnode.proto @@ -22,10 +22,10 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Version captures the consensus rules for processing a block in the blockchain, -// including all blockchain data structures and the rules of the application's -// state transition machine. -// This is equivalent to the tmversion.Consensus type in Tendermint. +// Version captures the consensus rules for processing a block in the +// blockchain, including all blockchain data structures and the rules of the +// application's state transition machine. This is equivalent to the +// tmversion.Consensus type in Tendermint. type Version struct { state protoimpl.MessageState `protogen:"open.v1"` Block uint64 `protobuf:"varint,1,opt,name=block,proto3" json:"block,omitempty"` @@ -89,18 +89,10 @@ type Header struct { Time uint64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"` // Previous block info LastHeaderHash []byte `protobuf:"bytes,4,opt,name=last_header_hash,json=lastHeaderHash,proto3" json:"last_header_hash,omitempty"` - // Commit from aggregator(s) from the last block - LastCommitHash []byte `protobuf:"bytes,5,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` // Block.Data root aka Transactions DataHash []byte `protobuf:"bytes,6,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"` - // Consensus params for current block - ConsensusHash []byte `protobuf:"bytes,7,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` // State after applying txs from the current block AppHash []byte `protobuf:"bytes,8,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - // Root hash of all results from the txs from the previous block. - // This is ABCI specific but smart-contract chains require some way of committing - // to transaction receipts/results. - LastResultsHash []byte `protobuf:"bytes,9,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // Original proposer of the block // Note that the address can be derived from the pubkey which can be derived // from the signature when using secp256k. @@ -173,13 +165,6 @@ func (x *Header) GetLastHeaderHash() []byte { return nil } -func (x *Header) GetLastCommitHash() []byte { - if x != nil { - return x.LastCommitHash - } - return nil -} - func (x *Header) GetDataHash() []byte { if x != nil { return x.DataHash @@ -187,13 +172,6 @@ func (x *Header) GetDataHash() []byte { return nil } -func (x *Header) GetConsensusHash() []byte { - if x != nil { - return x.ConsensusHash - } - return nil -} - func (x *Header) GetAppHash() []byte { if x != nil { return x.AppHash @@ -201,13 +179,6 @@ func (x *Header) GetAppHash() []byte { return nil } -func (x *Header) GetLastResultsHash() []byte { - if x != nil { - return x.LastResultsHash - } - return nil -} - func (x *Header) GetProposerAddress() []byte { if x != nil { return x.ProposerAddress @@ -621,21 +592,19 @@ const file_evnode_v1_evnode_proto_rawDesc = "" + "\x16evnode/v1/evnode.proto\x12\tevnode.v1\x1a\x1fgoogle/protobuf/timestamp.proto\"1\n" + "\aVersion\x12\x14\n" + "\x05block\x18\x01 \x01(\x04R\x05block\x12\x10\n" + - "\x03app\x18\x02 \x01(\x04R\x03app\"\xae\x03\n" + + "\x03app\x18\x02 \x01(\x04R\x03app\"\xc3\x02\n" + "\x06Header\x12,\n" + "\aversion\x18\x01 \x01(\v2\x12.evnode.v1.VersionR\aversion\x12\x16\n" + "\x06height\x18\x02 \x01(\x04R\x06height\x12\x12\n" + "\x04time\x18\x03 \x01(\x04R\x04time\x12(\n" + - "\x10last_header_hash\x18\x04 \x01(\fR\x0elastHeaderHash\x12(\n" + - "\x10last_commit_hash\x18\x05 \x01(\fR\x0elastCommitHash\x12\x1b\n" + - "\tdata_hash\x18\x06 \x01(\fR\bdataHash\x12%\n" + - "\x0econsensus_hash\x18\a \x01(\fR\rconsensusHash\x12\x19\n" + - "\bapp_hash\x18\b \x01(\fR\aappHash\x12*\n" + - "\x11last_results_hash\x18\t \x01(\fR\x0flastResultsHash\x12)\n" + + "\x10last_header_hash\x18\x04 \x01(\fR\x0elastHeaderHash\x12\x1b\n" + + "\tdata_hash\x18\x06 \x01(\fR\bdataHash\x12\x19\n" + + "\bapp_hash\x18\b \x01(\fR\aappHash\x12)\n" + "\x10proposer_address\x18\n" + " \x01(\fR\x0fproposerAddress\x12%\n" + "\x0evalidator_hash\x18\v \x01(\fR\rvalidatorHash\x12\x19\n" + - "\bchain_id\x18\f \x01(\tR\achainId\"\x82\x01\n" + + "\bchain_id\x18\f \x01(\tR\achainIdJ\x04\b\x05\x10\x06J\x04\b\a\x10\bJ\x04\b\t\x10\n" + + "\"\x82\x01\n" + "\fSignedHeader\x12)\n" + "\x06header\x18\x01 \x01(\v2\x11.evnode.v1.HeaderR\x06header\x12\x1c\n" + "\tsignature\x18\x02 \x01(\fR\tsignature\x12)\n" + diff --git a/types/pb/evnode/v1/execution.pb.go b/types/pb/evnode/v1/execution.pb.go index 0fc0f125b1..cd243512e1 100644 --- a/types/pb/evnode/v1/execution.pb.go +++ b/types/pb/evnode/v1/execution.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/execution.proto diff --git a/types/pb/evnode/v1/health.pb.go b/types/pb/evnode/v1/health.pb.go index aafe1640f9..1a76c46c7e 100644 --- a/types/pb/evnode/v1/health.pb.go +++ b/types/pb/evnode/v1/health.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/health.proto diff --git a/types/pb/evnode/v1/p2p_rpc.pb.go b/types/pb/evnode/v1/p2p_rpc.pb.go index c1c45e17ab..9325f84920 100644 --- a/types/pb/evnode/v1/p2p_rpc.pb.go +++ b/types/pb/evnode/v1/p2p_rpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/p2p_rpc.proto diff --git a/types/pb/evnode/v1/signer.pb.go b/types/pb/evnode/v1/signer.pb.go index b1f6ec3217..1b72b62a93 100644 --- a/types/pb/evnode/v1/signer.pb.go +++ b/types/pb/evnode/v1/signer.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/signer.proto diff --git a/types/pb/evnode/v1/state.pb.go b/types/pb/evnode/v1/state.pb.go index 18386afe78..9714fce0a6 100644 --- a/types/pb/evnode/v1/state.pb.go +++ b/types/pb/evnode/v1/state.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/state.proto @@ -31,7 +31,6 @@ type State struct { LastBlockHeight uint64 `protobuf:"varint,4,opt,name=last_block_height,json=lastBlockHeight,proto3" json:"last_block_height,omitempty"` LastBlockTime *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=last_block_time,json=lastBlockTime,proto3" json:"last_block_time,omitempty"` DaHeight uint64 `protobuf:"varint,6,opt,name=da_height,json=daHeight,proto3" json:"da_height,omitempty"` - LastResultsHash []byte `protobuf:"bytes,7,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` AppHash []byte `protobuf:"bytes,8,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache @@ -109,13 +108,6 @@ func (x *State) GetDaHeight() uint64 { return 0 } -func (x *State) GetLastResultsHash() []byte { - if x != nil { - return x.LastResultsHash - } - return nil -} - func (x *State) GetAppHash() []byte { if x != nil { return x.AppHash @@ -127,16 +119,15 @@ var File_evnode_v1_state_proto protoreflect.FileDescriptor const file_evnode_v1_state_proto_rawDesc = "" + "\n" + - "\x15evnode/v1/state.proto\x12\tevnode.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16evnode/v1/evnode.proto\"\xcb\x02\n" + + "\x15evnode/v1/state.proto\x12\tevnode.v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x16evnode/v1/evnode.proto\"\xa5\x02\n" + "\x05State\x12,\n" + "\aversion\x18\x01 \x01(\v2\x12.evnode.v1.VersionR\aversion\x12\x19\n" + "\bchain_id\x18\x02 \x01(\tR\achainId\x12%\n" + "\x0einitial_height\x18\x03 \x01(\x04R\rinitialHeight\x12*\n" + "\x11last_block_height\x18\x04 \x01(\x04R\x0flastBlockHeight\x12B\n" + "\x0flast_block_time\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\rlastBlockTime\x12\x1b\n" + - "\tda_height\x18\x06 \x01(\x04R\bdaHeight\x12*\n" + - "\x11last_results_hash\x18\a \x01(\fR\x0flastResultsHash\x12\x19\n" + - "\bapp_hash\x18\b \x01(\fR\aappHashB/Z-github.com/evstack/ev-node/types/pb/evnode/v1b\x06proto3" + "\tda_height\x18\x06 \x01(\x04R\bdaHeight\x12\x19\n" + + "\bapp_hash\x18\b \x01(\fR\aappHashJ\x04\b\a\x10\bB/Z-github.com/evstack/ev-node/types/pb/evnode/v1b\x06proto3" var ( file_evnode_v1_state_proto_rawDescOnce sync.Once diff --git a/types/pb/evnode/v1/state_rpc.pb.go b/types/pb/evnode/v1/state_rpc.pb.go index 0250f1921e..e087a82897 100644 --- a/types/pb/evnode/v1/state_rpc.pb.go +++ b/types/pb/evnode/v1/state_rpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.8 +// protoc-gen-go v1.36.10 // protoc (unknown) // source: evnode/v1/state_rpc.proto diff --git a/types/pb/evnode/v1/v1connect/config.connect.go b/types/pb/evnode/v1/v1connect/config.connect.go index 0677dd1ca5..e7fb47c1d4 100644 --- a/types/pb/evnode/v1/v1connect/config.connect.go +++ b/types/pb/evnode/v1/v1connect/config.connect.go @@ -46,7 +46,7 @@ const ( type ConfigServiceClient interface { // GetNamespace returns the namespace for this network GetNamespace(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.GetNamespaceResponse], error) - // GetSequencerInfo returns information about the sequencer + // GetSignerInfo returns information about the signer GetSignerInfo(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.GetSignerInfoResponse], error) } @@ -96,7 +96,7 @@ func (c *configServiceClient) GetSignerInfo(ctx context.Context, req *connect.Re type ConfigServiceHandler interface { // GetNamespace returns the namespace for this network GetNamespace(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.GetNamespaceResponse], error) - // GetSequencerInfo returns information about the sequencer + // GetSignerInfo returns information about the signer GetSignerInfo(context.Context, *connect.Request[emptypb.Empty]) (*connect.Response[v1.GetSignerInfoResponse], error) } diff --git a/types/serialization.go b/types/serialization.go index ee78a81654..8dfdef4fa5 100644 --- a/types/serialization.go +++ b/types/serialization.go @@ -148,11 +148,8 @@ func (h *Header) ToProto() *pb.Header { Height: h.BaseHeader.Height, Time: h.BaseHeader.Time, LastHeaderHash: h.LastHeaderHash[:], - LastCommitHash: h.LastCommitHash[:], DataHash: h.DataHash[:], - ConsensusHash: h.ConsensusHash[:], AppHash: h.AppHash[:], - LastResultsHash: h.LastResultsHash[:], ProposerAddress: h.ProposerAddress[:], ChainId: h.BaseHeader.ChainID, ValidatorHash: h.ValidatorHash, @@ -178,31 +175,19 @@ func (h *Header) FromProto(other *pb.Header) error { } else { h.LastHeaderHash = nil } - if other.LastCommitHash != nil { - h.LastCommitHash = append([]byte(nil), other.LastCommitHash...) - } else { - h.LastCommitHash = nil - } + if other.DataHash != nil { h.DataHash = append([]byte(nil), other.DataHash...) } else { h.DataHash = nil } - if other.ConsensusHash != nil { - h.ConsensusHash = append([]byte(nil), other.ConsensusHash...) - } else { - h.ConsensusHash = nil - } + if other.AppHash != nil { h.AppHash = append([]byte(nil), other.AppHash...) } else { h.AppHash = nil } - if other.LastResultsHash != nil { - h.LastResultsHash = append([]byte(nil), other.LastResultsHash...) - } else { - h.LastResultsHash = nil - } + if other.ProposerAddress != nil { h.ProposerAddress = append([]byte(nil), other.ProposerAddress...) } else { @@ -286,7 +271,6 @@ func (s *State) ToProto() (*pb.State, error) { LastBlockHeight: s.LastBlockHeight, LastBlockTime: timestamppb.New(s.LastBlockTime), DaHeight: s.DAHeight, - LastResultsHash: s.LastResultsHash[:], AppHash: s.AppHash[:], }, nil } @@ -312,11 +296,6 @@ func (s *State) FromProto(other *pb.State) error { } else { s.LastBlockTime = time.Time{} } - if other.LastResultsHash != nil { - s.LastResultsHash = append([]byte(nil), other.LastResultsHash...) - } else { - s.LastResultsHash = nil - } if other.AppHash != nil { s.AppHash = append([]byte(nil), other.AppHash...) } else { diff --git a/types/serialization_test.go b/types/serialization_test.go index d5c19c703d..7aff0103de 100644 --- a/types/serialization_test.go +++ b/types/serialization_test.go @@ -38,11 +38,8 @@ func TestBlockSerializationRoundTrip(t *testing.T) { Time: 4567, }, LastHeaderHash: h[0], - LastCommitHash: h[1], DataHash: h[2], - ConsensusHash: h[3], AppHash: h[4], - LastResultsHash: h[5], ProposerAddress: []byte{4, 3, 2, 1}, } @@ -118,7 +115,6 @@ func TestStateRoundTrip(t *testing.T) { LastBlockHeight: 987654321, LastBlockTime: time.Date(2022, 6, 6, 12, 12, 33, 44, time.UTC), DAHeight: 3344, - LastResultsHash: Hash{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2}, AppHash: Hash{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1}, }, }, @@ -345,22 +341,16 @@ func TestHeader_HashFields_NilAndEmpty(t *testing.T) { assert.NotNil(t, protoMsg) // All hash fields should be empty slices assert.Empty(t, protoMsg.LastHeaderHash) - assert.Empty(t, protoMsg.LastCommitHash) assert.Empty(t, protoMsg.DataHash) - assert.Empty(t, protoMsg.ConsensusHash) assert.Empty(t, protoMsg.AppHash) - assert.Empty(t, protoMsg.LastResultsHash) assert.Empty(t, protoMsg.ProposerAddress) assert.Empty(t, protoMsg.ValidatorHash) h2 := &Header{} assert.NoError(t, h2.FromProto(protoMsg)) assert.Nil(t, h2.LastHeaderHash) - assert.Nil(t, h2.LastCommitHash) assert.Nil(t, h2.DataHash) - assert.Nil(t, h2.ConsensusHash) assert.Nil(t, h2.AppHash) - assert.Nil(t, h2.LastResultsHash) assert.Nil(t, h2.ProposerAddress) assert.Nil(t, h2.ValidatorHash) } @@ -372,11 +362,8 @@ func TestProtoConversionConsistency_AllTypes(t *testing.T) { Version: Version{Block: 1, App: 2}, BaseHeader: BaseHeader{Height: 3, Time: 4, ChainID: "cid"}, LastHeaderHash: []byte{1, 2}, - LastCommitHash: []byte{3, 4}, DataHash: []byte{5, 6}, - ConsensusHash: []byte{7, 8}, AppHash: []byte{9, 10}, - LastResultsHash: []byte{11, 12}, ProposerAddress: []byte{13, 14}, ValidatorHash: []byte{15, 16}, } @@ -400,7 +387,7 @@ func TestProtoConversionConsistency_AllTypes(t *testing.T) { assert.Equal(t, d, d2) // State - s := &State{Version: Version{Block: 1, App: 2}, ChainID: "cid", InitialHeight: 1, LastBlockHeight: 2, LastBlockTime: time.Now().UTC(), DAHeight: 3, LastResultsHash: []byte{1, 2}, AppHash: []byte{3, 4}} + s := &State{Version: Version{Block: 1, App: 2}, ChainID: "cid", InitialHeight: 1, LastBlockHeight: 2, LastBlockTime: time.Now().UTC(), DAHeight: 3, AppHash: []byte{3, 4}} protoState, err := s.ToProto() assert.NoError(t, err) s2 := &State{} diff --git a/types/signed_header.go b/types/signed_header.go index f11bcbbc94..6c7d25d75a 100644 --- a/types/signed_header.go +++ b/types/signed_header.go @@ -12,9 +12,6 @@ import ( var ( // ErrLastHeaderHashMismatch is returned when the last header hash doesn't match. ErrLastHeaderHashMismatch = errors.New("last header hash mismatch") - - // ErrLastCommitHashMismatch is returned when the last commit hash doesn't match. - ErrLastCommitHashMismatch = errors.New("last commit hash mismatch") ) var _ header.Header[*SignedHeader] = &SignedHeader{} diff --git a/types/state.go b/types/state.go index d4597f7b73..374b119c92 100644 --- a/types/state.go +++ b/types/state.go @@ -28,9 +28,6 @@ type State struct { // DAHeight identifies DA block containing the latest applied Evolve block. DAHeight uint64 - // Merkle root of the results from executing prev block - LastResultsHash Hash - // the latest AppHash we've received from calling abci.Commit() AppHash []byte } diff --git a/types/utils.go b/types/utils.go index a14fe11867..d8c2527521 100644 --- a/types/utils.go +++ b/types/utils.go @@ -109,11 +109,8 @@ func GetRandomHeader(chainID string, appHash []byte) Header { App: InitStateVersion.App, }, LastHeaderHash: GetRandomBytes(32), - LastCommitHash: GetRandomBytes(32), DataHash: GetRandomBytes(32), - ConsensusHash: GetRandomBytes(32), AppHash: appHash, - LastResultsHash: GetRandomBytes(32), ProposerAddress: GetRandomBytes(32), ValidatorHash: GetRandomBytes(32), } @@ -231,7 +228,6 @@ func GetFirstSignedHeader(signer signer.Signer, chainID string) (*SignedHeader, App: InitStateVersion.App, }, LastHeaderHash: GetRandomBytes(32), - LastCommitHash: GetRandomBytes(32), DataHash: GetRandomBytes(32), AppHash: make([]byte, 32), ProposerAddress: addr,