Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert atomic.Pointer introduced in getLogs optim (#25199) #26686

Closed
wants to merge 1 commit into from

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Feb 14, 2023

Reverts #25199 which introduced atomic.Pointer. This feature is only available from Golang v1.19 and broke our v1.18 builds unfortunately. Sorry about that.

@holiman
Copy link
Contributor

holiman commented Feb 14, 2023

Can't you make a smaller revert whicih only replaces the atomic.Pointer with something go-1.18-friendly?

@holiman
Copy link
Contributor

holiman commented Feb 14, 2023

Can't you make a smaller revert whicih only replaces the atomic.Pointer with something go-1.18-friendly?

Sorry, I couldn't help myself, see #26688

@holiman
Copy link
Contributor

holiman commented Feb 14, 2023

Actually, this is probably the minimum viable diff

diff --git a/eth/filters/filter_system.go b/eth/filters/filter_system.go
index 42ea17d505..9fc20f335b 100644
--- a/eth/filters/filter_system.go
+++ b/eth/filters/filter_system.go
@@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {
 
 type logCacheElem struct {
 	logs []*types.Log
-	body atomic.Pointer[types.Body]
+	body atomic.Value
 }
 
 // cachedLogElem loads block logs from the backend and caches the result.
@@ -133,7 +133,7 @@ func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Has
 
 func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) {
 	if body := elem.body.Load(); body != nil {
-		return body, nil
+		return body.(*types.Body), nil
 	}
 	body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
 	if err != nil {

?

@holiman
Copy link
Contributor

holiman commented Feb 14, 2023

.... which @s1na already made :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants