From e600fd841a035f63be7c9078e523fbff815dbf2e Mon Sep 17 00:00:00 2001 From: Mateusz Morusiewicz <11313015+Ruteri@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:56:07 +0100 Subject: [PATCH] Adds missing AllowedPeekerAny checks (#85) --- suave/core/types.go | 2 +- suave/cstore/engine.go | 2 +- suave/cstore/transactional_store.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/suave/core/types.go b/suave/core/types.go index 936bb71f0..e21605103 100644 --- a/suave/core/types.go +++ b/suave/core/types.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/node" ) -var AllowedPeekerAny = common.HexToAddress("0x04994f67dc55b09e814ab7ffc8df3686b4afb2bb53e60eae97ef043fe03fb829") // "*" +var AllowedPeekerAny = common.HexToAddress("0xC8df3686b4Afb2BB53e60EAe97EF043FE03Fb829") // "*" type Bytes = hexutil.Bytes type BidId = types.BidId diff --git a/suave/cstore/engine.go b/suave/cstore/engine.go index 027a8839a..c50894ad4 100644 --- a/suave/cstore/engine.go +++ b/suave/cstore/engine.go @@ -344,7 +344,7 @@ func (e *ConfidentialStoreEngine) NewMessage(message DAMessage) error { return fmt.Errorf("confidential engine: sw signer %x not allowed to store on bid %x", recoveredMessageSigner, sw.Bid.Id) } - if !slices.Contains(sw.Bid.AllowedPeekers, sw.Caller) { + if !slices.Contains(sw.Bid.AllowedPeekers, sw.Caller) && !slices.Contains(sw.Bid.AllowedPeekers, suave.AllowedPeekerAny) { return fmt.Errorf("confidential engine: caller %x not allowed on bid %x", sw.Caller, sw.Bid.Id) } diff --git a/suave/cstore/transactional_store.go b/suave/cstore/transactional_store.go index 6a4c225f3..11bb69457 100644 --- a/suave/cstore/transactional_store.go +++ b/suave/cstore/transactional_store.go @@ -52,7 +52,7 @@ func (s *TransactionalStore) Store(bidId suave.BidId, caller common.Address, key return suave.Bid{}, err } - if !slices.Contains(bid.AllowedPeekers, caller) { + if !slices.Contains(bid.AllowedPeekers, caller) && !slices.Contains(bid.AllowedPeekers, suave.AllowedPeekerAny) { return suave.Bid{}, fmt.Errorf("confidential store transaction: %x not allowed to store %s on %x", caller, key, bidId) }