mps

package
v24.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package mps is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPrivateStateMetadata is the metadata for the single private state being used
	// when MPS is disabled
	DefaultPrivateStateMetadata = NewPrivateStateMetadata(
		types.DefaultPrivateStateIdentifier,
		"private",
		"legacy private state",
		Resident,
		nil,
	)
	// EmptyPrivateStateMetadata is the metadata for the empty private state being used
	// when MPS is enabled
	EmptyPrivateStateMetadata = NewPrivateStateMetadata(
		types.EmptyPrivateStateIdentifier,
		"empty",
		"empty state metadata",
		Resident,
		nil,
	)
)

Functions

func UpgradeDB

func UpgradeDB(db ethdb.Database, chain chainReader) error

UpgradeDB performs the following database operations to enable MPS support 1. Construct and persist Empty Private State with empty accounts 2. Construct and persist trie of root hashes of existing private states 3. Update new mapping: block header root -> trie of private states root 4. Once upgrade is complete update the ChainConfig.isMPS to true

Types

type DefaultPrivateStateRepository

type DefaultPrivateStateRepository struct {
	// contains filtered or unexported fields
}

DefaultPrivateStateRepository acts as the single private state in the original Quorum design.

func NewDefaultPrivateStateRepository

func NewDefaultPrivateStateRepository(db ethdb.Database, cache state.Database, privateCacheProvider privatecache.Provider, previousBlockHash common.Hash) (*DefaultPrivateStateRepository, error)

func (*DefaultPrivateStateRepository) Commit

func (dpsr *DefaultPrivateStateRepository) Commit(isEIP158 bool, block *types.Block) error

Commit commits the private state only

func (*DefaultPrivateStateRepository) CommitAndWrite

func (dpsr *DefaultPrivateStateRepository) CommitAndWrite(isEIP158 bool, block *types.Block) error

CommitAndWrite commits the private state and writes to disk

func (*DefaultPrivateStateRepository) Copy

func (*DefaultPrivateStateRepository) DefaultState

func (dpsr *DefaultPrivateStateRepository) DefaultState() (*state.StateDB, error)

func (*DefaultPrivateStateRepository) DefaultStateMetadata

func (dpsr *DefaultPrivateStateRepository) DefaultStateMetadata() *PrivateStateMetadata

func (*DefaultPrivateStateRepository) IsMPS

func (dpsr *DefaultPrivateStateRepository) IsMPS() bool

func (*DefaultPrivateStateRepository) MergeReceipts

func (dpsr *DefaultPrivateStateRepository) MergeReceipts(pub, priv types.Receipts) types.Receipts

Given a slice of public receipts and an overlapping (smaller) slice of private receipts, return a new slice where the default for each location is the public receipt but we take the private receipt in each place we have one.

func (*DefaultPrivateStateRepository) PrivateStateRoot

func (*DefaultPrivateStateRepository) Reset

func (dpsr *DefaultPrivateStateRepository) Reset() error

func (*DefaultPrivateStateRepository) StatePSI

type MockPrivateStateManager

type MockPrivateStateManager struct {
	// contains filtered or unexported fields
}

MockPrivateStateManager is a mock of PrivateStateManager interface.

func NewMockPrivateStateManager

func NewMockPrivateStateManager(ctrl *gomock.Controller) *MockPrivateStateManager

NewMockPrivateStateManager creates a new mock instance.

func (*MockPrivateStateManager) CheckAt

func (m *MockPrivateStateManager) CheckAt(blockHash common.Hash) error

CheckAt mocks base method.

func (*MockPrivateStateManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPrivateStateManager) NotIncludeAny

func (m *MockPrivateStateManager) NotIncludeAny(psm *PrivateStateMetadata, managedParties ...string) bool

NotIncludeAny mocks base method.

func (*MockPrivateStateManager) PSIs

PSIs mocks base method.

func (*MockPrivateStateManager) ResolveForManagedParty

func (m *MockPrivateStateManager) ResolveForManagedParty(managedParty string) (*PrivateStateMetadata, error)

ResolveForManagedParty mocks base method.

func (*MockPrivateStateManager) ResolveForUserContext

func (m *MockPrivateStateManager) ResolveForUserContext(ctx context.Context) (*PrivateStateMetadata, error)

ResolveForUserContext mocks base method.

func (*MockPrivateStateManager) StateRepository

func (m *MockPrivateStateManager) StateRepository(blockHash common.Hash) (PrivateStateRepository, error)

StateRepository mocks base method.

func (*MockPrivateStateManager) TrieDB

func (m *MockPrivateStateManager) TrieDB() *trie.Database

TrieDB mocks base method.

type MockPrivateStateManagerMockRecorder

type MockPrivateStateManagerMockRecorder struct {
	// contains filtered or unexported fields
}

MockPrivateStateManagerMockRecorder is the mock recorder for MockPrivateStateManager.

func (*MockPrivateStateManagerMockRecorder) CheckAt

func (mr *MockPrivateStateManagerMockRecorder) CheckAt(blockHash interface{}) *gomock.Call

CheckAt indicates an expected call of CheckAt.

func (*MockPrivateStateManagerMockRecorder) NotIncludeAny

func (mr *MockPrivateStateManagerMockRecorder) NotIncludeAny(psm interface{}, managedParties ...interface{}) *gomock.Call

NotIncludeAny indicates an expected call of NotIncludeAny.

func (*MockPrivateStateManagerMockRecorder) PSIs

PSIs indicates an expected call of PSIs.

func (*MockPrivateStateManagerMockRecorder) ResolveForManagedParty

func (mr *MockPrivateStateManagerMockRecorder) ResolveForManagedParty(managedParty interface{}) *gomock.Call

ResolveForManagedParty indicates an expected call of ResolveForManagedParty.

func (*MockPrivateStateManagerMockRecorder) ResolveForUserContext

func (mr *MockPrivateStateManagerMockRecorder) ResolveForUserContext(ctx interface{}) *gomock.Call

ResolveForUserContext indicates an expected call of ResolveForUserContext.

func (*MockPrivateStateManagerMockRecorder) StateRepository

func (mr *MockPrivateStateManagerMockRecorder) StateRepository(blockHash interface{}) *gomock.Call

StateRepository indicates an expected call of StateRepository.

func (*MockPrivateStateManagerMockRecorder) TrieDB

TrieDB indicates an expected call of TrieDB.

type MockPrivateStateMetadataResolver

type MockPrivateStateMetadataResolver struct {
	// contains filtered or unexported fields
}

MockPrivateStateMetadataResolver is a mock of PrivateStateMetadataResolver interface.

func NewMockPrivateStateMetadataResolver

func NewMockPrivateStateMetadataResolver(ctrl *gomock.Controller) *MockPrivateStateMetadataResolver

NewMockPrivateStateMetadataResolver creates a new mock instance.

func (*MockPrivateStateMetadataResolver) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPrivateStateMetadataResolver) NotIncludeAny

func (m *MockPrivateStateMetadataResolver) NotIncludeAny(psm *PrivateStateMetadata, managedParties ...string) bool

NotIncludeAny mocks base method.

func (*MockPrivateStateMetadataResolver) PSIs

PSIs mocks base method.

func (*MockPrivateStateMetadataResolver) ResolveForManagedParty

func (m *MockPrivateStateMetadataResolver) ResolveForManagedParty(managedParty string) (*PrivateStateMetadata, error)

ResolveForManagedParty mocks base method.

func (*MockPrivateStateMetadataResolver) ResolveForUserContext

ResolveForUserContext mocks base method.

type MockPrivateStateMetadataResolverMockRecorder

type MockPrivateStateMetadataResolverMockRecorder struct {
	// contains filtered or unexported fields
}

MockPrivateStateMetadataResolverMockRecorder is the mock recorder for MockPrivateStateMetadataResolver.

func (*MockPrivateStateMetadataResolverMockRecorder) NotIncludeAny

func (mr *MockPrivateStateMetadataResolverMockRecorder) NotIncludeAny(psm interface{}, managedParties ...interface{}) *gomock.Call

NotIncludeAny indicates an expected call of NotIncludeAny.

func (*MockPrivateStateMetadataResolverMockRecorder) PSIs

PSIs indicates an expected call of PSIs.

func (*MockPrivateStateMetadataResolverMockRecorder) ResolveForManagedParty

func (mr *MockPrivateStateMetadataResolverMockRecorder) ResolveForManagedParty(managedParty interface{}) *gomock.Call

ResolveForManagedParty indicates an expected call of ResolveForManagedParty.

func (*MockPrivateStateMetadataResolverMockRecorder) ResolveForUserContext

func (mr *MockPrivateStateMetadataResolverMockRecorder) ResolveForUserContext(ctx interface{}) *gomock.Call

ResolveForUserContext indicates an expected call of ResolveForUserContext.

type MockPrivateStateRepository

type MockPrivateStateRepository struct {
	// contains filtered or unexported fields
}

MockPrivateStateRepository is a mock of PrivateStateRepository interface.

func NewMockPrivateStateRepository

func NewMockPrivateStateRepository(ctrl *gomock.Controller) *MockPrivateStateRepository

NewMockPrivateStateRepository creates a new mock instance.

func (*MockPrivateStateRepository) Commit

func (m *MockPrivateStateRepository) Commit(isEIP158 bool, block *types.Block) error

Commit mocks base method.

func (*MockPrivateStateRepository) CommitAndWrite

func (m *MockPrivateStateRepository) CommitAndWrite(isEIP158 bool, block *types.Block) error

CommitAndWrite mocks base method.

func (*MockPrivateStateRepository) Copy

Copy mocks base method.

func (*MockPrivateStateRepository) DefaultState

func (m *MockPrivateStateRepository) DefaultState() (*state.StateDB, error)

DefaultState mocks base method.

func (*MockPrivateStateRepository) DefaultStateMetadata

func (m *MockPrivateStateRepository) DefaultStateMetadata() *PrivateStateMetadata

DefaultStateMetadata mocks base method.

func (*MockPrivateStateRepository) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockPrivateStateRepository) IsMPS

func (m *MockPrivateStateRepository) IsMPS() bool

IsMPS mocks base method.

func (*MockPrivateStateRepository) MergeReceipts

func (m *MockPrivateStateRepository) MergeReceipts(pub, priv types.Receipts) types.Receipts

MergeReceipts mocks base method.

func (*MockPrivateStateRepository) PrivateStateRoot

PrivateStateRoot mocks base method.

func (*MockPrivateStateRepository) Reset

func (m *MockPrivateStateRepository) Reset() error

Reset mocks base method.

func (*MockPrivateStateRepository) StatePSI

StatePSI mocks base method.

type MockPrivateStateRepositoryMockRecorder

type MockPrivateStateRepositoryMockRecorder struct {
	// contains filtered or unexported fields
}

MockPrivateStateRepositoryMockRecorder is the mock recorder for MockPrivateStateRepository.

func (*MockPrivateStateRepositoryMockRecorder) Commit

func (mr *MockPrivateStateRepositoryMockRecorder) Commit(isEIP158, block interface{}) *gomock.Call

Commit indicates an expected call of Commit.

func (*MockPrivateStateRepositoryMockRecorder) CommitAndWrite

func (mr *MockPrivateStateRepositoryMockRecorder) CommitAndWrite(isEIP158, block interface{}) *gomock.Call

CommitAndWrite indicates an expected call of CommitAndWrite.

func (*MockPrivateStateRepositoryMockRecorder) Copy

Copy indicates an expected call of Copy.

func (*MockPrivateStateRepositoryMockRecorder) DefaultState

DefaultState indicates an expected call of DefaultState.

func (*MockPrivateStateRepositoryMockRecorder) DefaultStateMetadata

func (mr *MockPrivateStateRepositoryMockRecorder) DefaultStateMetadata() *gomock.Call

DefaultStateMetadata indicates an expected call of DefaultStateMetadata.

func (*MockPrivateStateRepositoryMockRecorder) IsMPS

IsMPS indicates an expected call of IsMPS.

func (*MockPrivateStateRepositoryMockRecorder) MergeReceipts

func (mr *MockPrivateStateRepositoryMockRecorder) MergeReceipts(pub, priv interface{}) *gomock.Call

MergeReceipts indicates an expected call of MergeReceipts.

func (*MockPrivateStateRepositoryMockRecorder) PrivateStateRoot

func (mr *MockPrivateStateRepositoryMockRecorder) PrivateStateRoot(psi interface{}) *gomock.Call

PrivateStateRoot indicates an expected call of PrivateStateRoot.

func (*MockPrivateStateRepositoryMockRecorder) Reset

Reset indicates an expected call of Reset.

func (*MockPrivateStateRepositoryMockRecorder) StatePSI

func (mr *MockPrivateStateRepositoryMockRecorder) StatePSI(psi interface{}) *gomock.Call

StatePSI indicates an expected call of StatePSI.

type MultiplePrivateStateRepository

type MultiplePrivateStateRepository struct {
	// contains filtered or unexported fields
}

MultiplePrivateStateRepository manages a number of state DB objects identified by their types.PrivateStateIdentifier. It also maintains a trie of private states whose root hash is mapped with a block hash.

func NewMultiplePrivateStateRepository

func NewMultiplePrivateStateRepository(db ethdb.Database, cache state.Database, privateStatesTrieRoot common.Hash, privateCacheProvider privatecache.Provider) (*MultiplePrivateStateRepository, error)

func (*MultiplePrivateStateRepository) Commit

func (mpsr *MultiplePrivateStateRepository) Commit(isEIP158 bool, block *types.Block) error

Commit commits all private states, updates the trie of private states only

func (*MultiplePrivateStateRepository) CommitAndWrite

func (mpsr *MultiplePrivateStateRepository) CommitAndWrite(isEIP158 bool, block *types.Block) error

CommitAndWrite commits all private states, updates the trie of private states, writes to disk

func (*MultiplePrivateStateRepository) Copy

func (*MultiplePrivateStateRepository) DefaultState

func (mpsr *MultiplePrivateStateRepository) DefaultState() (*state.StateDB, error)

func (*MultiplePrivateStateRepository) DefaultStateMetadata

func (mpsr *MultiplePrivateStateRepository) DefaultStateMetadata() *PrivateStateMetadata

func (*MultiplePrivateStateRepository) IsMPS

func (mpsr *MultiplePrivateStateRepository) IsMPS() bool

func (*MultiplePrivateStateRepository) MergeReceipts

func (mpsr *MultiplePrivateStateRepository) MergeReceipts(pub, priv types.Receipts) types.Receipts

Given a slice of public receipts and an overlapping (smaller) slice of private receipts, return a new slice where the default for each location is the public receipt but we take the private receipt in each place we have one. Each entry for a private receipt will actually consist of a copy of a dummy auxiliary receipt, which holds the real private receipts for each PSI under PSReceipts[]. Note that we also add a private receipt for the "empty" PSI.

func (*MultiplePrivateStateRepository) PrivateStateRoot

func (*MultiplePrivateStateRepository) Reset

func (mpsr *MultiplePrivateStateRepository) Reset() error

func (*MultiplePrivateStateRepository) StatePSI

type PrivateStateManager

type PrivateStateManager interface {
	PrivateStateMetadataResolver
	// StateRepository returns repository corresponding to a block hash
	StateRepository(blockHash common.Hash) (PrivateStateRepository, error)
	// CheckAt verifies if there's a state being managed at a block hash
	CheckAt(blockHash common.Hash) error
	// TrieDB returns the trie database
	TrieDB() *trie.Database
}

PrivateStateManager interface separates

type PrivateStateMetadata

type PrivateStateMetadata struct {
	ID          types.PrivateStateIdentifier
	Name        string
	Description string
	Type        PrivateStateType
	// Addresses stores the public keys in the SAME ORDER being configured
	// in Tessera
	Addresses []string
	// contains filtered or unexported fields
}

PrivateStateMetadata is the domain model in Quorum which maps with PrivacyGroup domain in Tessera

func NewPrivateStateMetadata

func NewPrivateStateMetadata(id types.PrivateStateIdentifier, name, desc string, t PrivateStateType, addresses []string) *PrivateStateMetadata

func (*PrivateStateMetadata) FilterAddresses

func (psm *PrivateStateMetadata) FilterAddresses(addresses ...string) []string

func (*PrivateStateMetadata) NotIncludeAny

func (psm *PrivateStateMetadata) NotIncludeAny(addresses ...string) bool

func (*PrivateStateMetadata) String

func (psm *PrivateStateMetadata) String() string

type PrivateStateMetadataResolver

type PrivateStateMetadataResolver interface {
	ResolveForManagedParty(managedParty string) (*PrivateStateMetadata, error)
	ResolveForUserContext(ctx context.Context) (*PrivateStateMetadata, error)
	// PSIs returns list of types.PrivateStateIdentifier being managed
	PSIs() []types.PrivateStateIdentifier
	// NotIncludeAny returns true if NONE of the managedParties is a member
	// of the given psm, otherwise returns false
	NotIncludeAny(psm *PrivateStateMetadata, managedParties ...string) bool
}

type PrivateStateRepository

type PrivateStateRepository interface {
	PrivateStateRoot(psi types.PrivateStateIdentifier) (common.Hash, error)
	StatePSI(psi types.PrivateStateIdentifier) (*state.StateDB, error)
	CommitAndWrite(isEIP158 bool, block *types.Block) error
	Commit(isEIP158 bool, block *types.Block) error
	Copy() PrivateStateRepository
	Reset() error
	DefaultState() (*state.StateDB, error)
	DefaultStateMetadata() *PrivateStateMetadata
	IsMPS() bool
	MergeReceipts(pub, priv types.Receipts) types.Receipts
}

PrivateStateRepository abstracts how we handle private state(s) including retrieving from and peristing private states to the underlying database

type PrivateStateType

type PrivateStateType uint64
const (
	Resident PrivateStateType = iota                          // 0
	Legacy   PrivateStateType = 1 << PrivateStateType(iota-1) // 1
	Pantheon PrivateStateType = 1 << PrivateStateType(iota-1) // 2
)

type StateRootProviderFunc

type StateRootProviderFunc func(isEIP158 bool) (common.Hash, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL