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

block is not present in the archive (non-empty archive, last block "blocknumber") #236

Open
1aBcD1234aBcD1 opened this issue Oct 17, 2024 · 0 comments

Comments

@1aBcD1234aBcD1
Copy link

Describe the bug
A clear and concise description of what the bug is.
Hello everyone. Im a developing some stuff that needs real time on chain execution and I just encountered this error when making requests using my local archive node.

The error can be reproduce just by subscribing to new heads using the standard goethereum client, and just requesting onchain information of that block, which should be the latest one. Maybe is something intended, however when you try to ask information from the received header I always get as an example panic: block 94922164 is not present in the archive (non-empty archive, last block 94922163)

To Reproduce
Steps to reproduce the behavior:

  1. Test code to reproduce
package main

import (
	"context"
	"fmt"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
	"github.com/ethereum/go-ethereum/ethclient"
)

func main() {
	ethClient, err := ethclient.Dial("/opt/sonic/data/opera.ipc")
	if err != nil {
		panic(err)
	}

	ch := make(chan *types.Header, 10)
	sub, err := ethClient.SubscribeNewHead(context.Background(), ch)
	if err != nil {
		panic(err)
	}

	for {
		c := <-ch
		b, err := ethClient.BalanceAt(context.Background(), common.Address{}, c.Number)
		if err != nil {
			sub.Unsubscribe()
			panic(err)
		}
		fmt.Println(b, c.Number)
	}
}
  1. Error obtained as an example:
    panic: block 94922467 is not present in the archive (non-empty archive, last block 94922466)

Expected behavior
By adding a waiting time of 0.4 (expect time between two block) time.Sleep(time.Millisecond * 400) you get the following output:

2137410229675161653917591 94922477
2137410229675161653917591 94922478
2137410229675161653917591 94922479
2137410229675161653917591 94922480
2137410229675161653917591 94922481
2137410229675161653917591 94922482
2137410229675161653917591 94922483
2137410229675161653917591 94922484
2137410229675161653917591 94922485
2137410229675161653917591 94922486

Desktop (please complete the following information):

  • Sonic version: Sonic/v1.2.1
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

No branches or pull requests

1 participant