diff --git a/blockchain/pending.go b/blockchain/pending.go index b69cd0ee06..5638ac9c35 100644 --- a/blockchain/pending.go +++ b/blockchain/pending.go @@ -1,8 +1,10 @@ package blockchain import ( + "errors" "github.com/NethermindEth/juno/core" "github.com/NethermindEth/juno/core/felt" + "github.com/NethermindEth/juno/core/trie" ) type Pending struct { @@ -65,3 +67,22 @@ func (p *PendingState) Class(classHash *felt.Felt) (*core.DeclaredClass, error) return p.head.Class(classHash) } + +// Note[pnowosie]: Maybe extending StateReader with the following methods was not a good idea? +func (s *PendingState) ClassTrie() (*trie.Trie, func() error, error) { + return nil, nopCloser, featureNotImplemented +} +func (s *PendingState) StorageTrie() (*trie.Trie, func() error, error) { + return nil, nopCloser, featureNotImplemented +} +func (s *PendingState) StorageTrieForAddr(*felt.Felt) (*trie.Trie, error) { + return nil, featureNotImplemented +} +func (s *PendingState) StateAndClassRoot() (*felt.Felt, *felt.Felt, error) { + return nil, nil, featureNotImplemented +} + +var ( + featureNotImplemented = errors.New("feature not implemented for a historical state") + nopCloser = func() error { return nil } +) diff --git a/core/state_snapshot.go b/core/state_snapshot.go index a7062d4dae..723aa1e5fd 100644 --- a/core/state_snapshot.go +++ b/core/state_snapshot.go @@ -2,6 +2,7 @@ package core import ( "errors" + "github.com/NethermindEth/juno/core/trie" "github.com/NethermindEth/juno/core/felt" "github.com/NethermindEth/juno/db" @@ -87,3 +88,22 @@ func (s *stateSnapshot) Class(classHash *felt.Felt) (*DeclaredClass, error) { } return declaredClass, nil } + +// Note[pnowosie]: Maybe extending StateReader with the following methods was not a good idea? +func (s *stateSnapshot) ClassTrie() (*trie.Trie, func() error, error) { + return nil, nopCloser, featureNotImplemented +} +func (s *stateSnapshot) StorageTrie() (*trie.Trie, func() error, error) { + return nil, nopCloser, featureNotImplemented +} +func (s *stateSnapshot) StorageTrieForAddr(*felt.Felt) (*trie.Trie, error) { + return nil, featureNotImplemented +} +func (s *stateSnapshot) StateAndClassRoot() (*felt.Felt, *felt.Felt, error) { + return nil, nil, featureNotImplemented +} + +var ( + featureNotImplemented = errors.New("feature not implemented for a historical state") + nopCloser = func() error { return nil } +)