diff --git a/.changelog/5305.trivial.md b/.changelog/5305.trivial.md new file mode 100644 index 00000000000..e69de29bb2d diff --git a/go/consensus/api/api.go b/go/consensus/api/api.go index c1164d2efad..5d8754076b2 100644 --- a/go/consensus/api/api.go +++ b/go/consensus/api/api.go @@ -132,13 +132,6 @@ type ClientBackend interface { // client verification. GetLightBlock(ctx context.Context, height int64) (*LightBlock, error) - // GetLightBlockForState returns a light block for the state as of executing the consensus layer - // block at the specified height. Note that the height of the returned block may differ - // depending on consensus layer implementation details. - // - // In case light block for the given height is not yet available, it returns ErrVersionNotFound. - GetLightBlockForState(ctx context.Context, height int64) (*LightBlock, error) - // State returns a MKVS read syncer that can be used to read consensus state from a remote node // and verify it against the trusted local root. State() syncer.ReadSyncer diff --git a/go/consensus/api/grpc.go b/go/consensus/api/grpc.go index a3b127ddf44..c52824a34a9 100644 --- a/go/consensus/api/grpc.go +++ b/go/consensus/api/grpc.go @@ -38,8 +38,6 @@ var ( methodGetBlock = serviceName.NewMethod("GetBlock", int64(0)) // methodGetLightBlock is the GetLightBlock method. methodGetLightBlock = serviceName.NewMethod("GetLightBlock", int64(0)) - // methodGetLightBlockForState is the GetLightBlockForState method. - methodGetLightBlockForState = serviceName.NewMethod("GetLightBlockForState", int64(0)) // methodGetTransactions is the GetTransactions method. methodGetTransactions = serviceName.NewMethod("GetTransactions", int64(0)) // methodGetTransactionsWithResults is the GetTransactionsWithResults method. @@ -107,10 +105,6 @@ var ( MethodName: methodGetLightBlock.ShortName(), Handler: handlerGetLightBlock, }, - { - MethodName: methodGetLightBlockForState.ShortName(), - Handler: handlerGetLightBlockForState, - }, { MethodName: methodGetTransactions.ShortName(), Handler: handlerGetTransactions, @@ -358,29 +352,6 @@ func handlerGetLightBlock( return interceptor(ctx, height, info, handler) } -func handlerGetLightBlockForState( - srv interface{}, - ctx context.Context, - dec func(interface{}) error, - interceptor grpc.UnaryServerInterceptor, -) (interface{}, error) { - var height int64 - if err := dec(&height); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ClientBackend).GetLightBlockForState(ctx, height) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: methodGetLightBlockForState.FullName(), - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ClientBackend).GetLightBlockForState(ctx, req.(int64)) - } - return interceptor(ctx, height, info, handler) -} - func handlerGetTransactions( srv interface{}, ctx context.Context, @@ -753,14 +724,6 @@ func (c *consensusClient) GetLightBlock(ctx context.Context, height int64) (*Lig return &rsp, nil } -func (c *consensusClient) GetLightBlockForState(ctx context.Context, height int64) (*LightBlock, error) { - var rsp LightBlock - if err := c.conn.Invoke(ctx, methodGetLightBlockForState.FullName(), height, &rsp); err != nil { - return nil, err - } - return &rsp, nil -} - func (c *consensusClient) GetTransactions(ctx context.Context, height int64) ([][]byte, error) { var rsp [][]byte if err := c.conn.Invoke(ctx, methodGetTransactions.FullName(), height, &rsp); err != nil { diff --git a/go/consensus/cometbft/full/common.go b/go/consensus/cometbft/full/common.go index 6b5fea20535..f380abe0894 100644 --- a/go/consensus/cometbft/full/common.go +++ b/go/consensus/cometbft/full/common.go @@ -13,7 +13,6 @@ import ( cmtcoretypes "github.com/cometbft/cometbft/rpc/core/types" cmtrpctypes "github.com/cometbft/cometbft/rpc/jsonrpc/types" "github.com/cometbft/cometbft/state" - cmtstate "github.com/cometbft/cometbft/state" "github.com/cometbft/cometbft/store" cmttypes "github.com/cometbft/cometbft/types" @@ -559,15 +558,6 @@ func (n *commonNode) GetBlock(ctx context.Context, height int64) (*consensusAPI. // Implements consensusAPI.Backend. func (n *commonNode) GetLightBlock(ctx context.Context, height int64) (*consensusAPI.LightBlock, error) { - return n.getLightBlock(ctx, height, false) -} - -// Implements consensusAPI.Backend. -func (n *commonNode) GetLightBlockForState(ctx context.Context, height int64) (*consensusAPI.LightBlock, error) { - return n.getLightBlock(ctx, height+1, true) -} - -func (n *commonNode) getLightBlock(ctx context.Context, height int64, allowPending bool) (*consensusAPI.LightBlock, error) { if err := n.ensureStarted(ctx); err != nil { return nil, err } @@ -589,24 +579,8 @@ func (n *commonNode) getLightBlock(ctx context.Context, height int64, allowPendi if err == nil && commit != nil && commit.Header != nil { lb.SignedHeader = &commit.SignedHeader tmHeight = commit.Header.Height - } else if allowPending { - // The specified height seems to be for the "next" block that has not yet been finalized. We - // construct a "pending" block instead (this block cannot be verified by a light client as - // it doesn't have any commits). - var state cmtstate.State - state, err = n.stateStore.Load() - if err != nil { - return nil, fmt.Errorf("cometbft: failed to fetch latest blockchain state: %w", err) - } - - commit := cmttypes.NewCommit(height, 0, cmttypes.BlockID{}, nil) - var proposerAddr [20]byte - blk := state.MakeBlock(height, nil, commit, nil, proposerAddr[:]) - lb.SignedHeader = &cmttypes.SignedHeader{ - Header: &blk.Header, - Commit: commit, - } } + protoLb, err := lb.ToProto() if err != nil { return nil, fmt.Errorf("cometbft: failed to convert light block: %w", err) diff --git a/go/worker/client/committee/node.go b/go/worker/client/committee/node.go index 49a4b45b6fa..c16959b2a15 100644 --- a/go/worker/client/committee/node.go +++ b/go/worker/client/committee/node.go @@ -2,7 +2,6 @@ package committee import ( "context" - "errors" "fmt" "sync" "time" @@ -10,12 +9,9 @@ import ( "github.com/cenkalti/backoff/v4" "github.com/eapache/channels" - beacon "github.com/oasisprotocol/oasis-core/go/beacon/api" cmnBackoff "github.com/oasisprotocol/oasis-core/go/common/backoff" "github.com/oasisprotocol/oasis-core/go/common/crypto/hash" "github.com/oasisprotocol/oasis-core/go/common/logging" - consensus "github.com/oasisprotocol/oasis-core/go/consensus/api" - roothash "github.com/oasisprotocol/oasis-core/go/roothash/api" "github.com/oasisprotocol/oasis-core/go/roothash/api/block" runtime "github.com/oasisprotocol/oasis-core/go/runtime/api" "github.com/oasisprotocol/oasis-core/go/runtime/client/api" @@ -140,66 +136,6 @@ func (n *Node) Query(ctx context.Context, round uint64, method string, args []by return nil, api.ErrNoHostedRuntime } maxMessages := dsc.Executor.MaxMessages - latestRound := n.commonNode.CurrentBlock.Header.Round - - rtInfo, err := hrt.GetInfo(ctx) - if err != nil { - return nil, fmt.Errorf("client: failed to fetch runtime info: %w", err) - } - - // TODO: Remove once same block consensus validation is deployed. - if !rtInfo.Features.SameBlockConsensusValidation { - var resolvedRound uint64 - queryFn := func(round uint64) ([]byte, error) { - var annBlk *roothash.AnnotatedBlock - annBlk, err = n.commonNode.Runtime.History().GetAnnotatedBlock(ctx, round) - if err != nil { - return nil, fmt.Errorf("client: failed to fetch annotated block from history: %w", err) - } - resolvedRound = annBlk.Block.Header.Round - - // Get consensus light block for state after executing block at given height. - var lb *consensus.LightBlock - lb, err = n.commonNode.Consensus.GetLightBlockForState(ctx, annBlk.Height) - if err != nil { - return nil, fmt.Errorf("client: failed to get light block at height %d: %w", annBlk.Height, err) - } - var epoch beacon.EpochTime - epoch, err = n.commonNode.Consensus.Beacon().GetEpoch(ctx, annBlk.Height) - if err != nil { - return nil, fmt.Errorf("client: failed to get epoch at height %d: %w", annBlk.Height, err) - } - - return hrt.Query(ctx, annBlk.Block, lb, epoch, maxMessages, method, args) - } - - var data []byte - data, err = queryFn(round) - if errors.Is(err, protocol.ErrVerifierVerificationFailed) { - // The query failed due to the runtime's consensus verifier failing to verify the given - // header. We assume that this is because a finalized header is not yet available for the - // given round. - switch round { - case api.RoundLatest, latestRound: - // Since we are allowed to decide what we see as the latest round, use an earlier one. - n.logger.Debug("runtime's consensus verifier reports failure, retrying", - "method", method, - "target_round", resolvedRound, - ) - - data, err = queryFn(resolvedRound - 1) - default: - // A specific round was given so this query is not yet possible. - n.logger.Debug("runtime's consensus verifier reports failure", - "method", method, - "target_round", round, - ) - - return nil, roothash.ErrNotFound - } - } - return data, err - } annBlk, err := n.commonNode.Runtime.History().GetAnnotatedBlock(ctx, round) if err != nil { diff --git a/runtime/src/types.rs b/runtime/src/types.rs index 6a6a69c71bc..f12eb268fba 100644 --- a/runtime/src/types.rs +++ b/runtime/src/types.rs @@ -348,9 +348,6 @@ pub struct Features { /// A feature specifying that the runtime supports rotating key manager's master secret. #[cbor(optional)] pub key_manager_master_secret_rotation: bool, - /// A feature specifying that the runtime supports same-block consensus validation. - #[cbor(optional)] - pub same_block_consensus_validation: bool, } impl Default for Features { @@ -360,7 +357,6 @@ impl Default for Features { key_manager_quote_policy_updates: true, key_manager_status_updates: true, key_manager_master_secret_rotation: false, - same_block_consensus_validation: true, } } }