0xFacet / facet-vm

This app implements the Facet Protocol. It processes Dumb Contract interactions and makes the results available via an HTTP API.
https://docs.facet.org
104 stars 18 forks source link

ERROR -- : Unexpected error: {"message"=>"Count is off"} (RuntimeError) #114

Closed cebook closed 9 months ago

cebook commented 10 months ago

Hello,I followed redme instructions and went to: bundle exec clockwork config/clock.rb The program reports the following error,Please analyze it for me. Thank you.

/opt/eths/facet-vm# bundle exec clockwork config/clock.rb I, [2023-12-03T13:01:03.987078 #2155288] INFO -- : Starting clock for 2 events: [ Sync ethscriptions check_for_reorgs ] I, [2023-12-03T13:01:03.988393 #2155288] INFO -- : Triggering 'Sync ethscriptions' E, [2023-12-03T13:01:06.785472 #2155288] ERROR -- : Unexpected error: {"message"=>"Count is off"} (RuntimeError) /opt/eths/facet-vm/app/models/ethscription_sync.rb:110:in block in import_eth_block_batch' /usr/local/rvm/gems/ruby-3.2.2/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:535:inblock in within_new_transaction' /usr/local/rvm/gems/ruby-3.2.2/gems/activesupport-7.1.2/lib/active_support/concurrency/null_lock.rb:9:in synchronize' /usr/local/rvm/gems/ruby-3.2.2/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/transaction.rb:532:inwithin_new_transaction' /usr/local/rvm/gems/ruby-3.2.2/gems/activerecord-7.1.2/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in transaction' /usr/local/rvm/gems/ruby-3.2.2/gems/activerecord-7.1.2/lib/active_record/transactions.rb:212:intransaction' /opt/eths/facet-vm/app/models/ethscription_sync.rb:90:in import_eth_block_batch' /opt/eths/facet-vm/app/models/ethscription_sync.rb:45:inblock in import_eth_blocks_until_done' /opt/eths/facet-vm/app/models/ethscription_sync.rb:44:in loop' /opt/eths/facet-vm/app/models/ethscription_sync.rb:44:inimport_eth_blocks_until_done' /opt/eths/facet-vm/config/clock.rb:25:in block in <module:Clockwork>' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/event.rb:61:inexecute' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/event.rb:48:in run' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:136:inblock in tick' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:134:in each' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:134:intick' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:123:in block (2 levels) in run_tick_loop' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:121:insynchronize' /usr/local/rvm/gems/ruby-3.2.2/gems/clockwork-3.0.2/lib/clockwork/manager.rb:121:in `block in run_tick_loop' I, [2023-12-03T13:01:06.786738 #2155288] INFO -- : Finished 'Sync ethscriptions' duration_ms=2798 error=#<RuntimeError: Unexpected error: {"message"=>"Count is off"}> I, [2023-12-03T13:01:06.787694 #2155288] INFO -- : Triggering 'check_for_reorgs' I, [2023-12-03T13:01:07.301119 #2155288] INFO -- : Finished 'check_for_reorgs' duration_ms=513 error=nil I, [2023-12-03T13:01:08.001340 #2155288] INFO -- : Triggering 'Sync ethscriptions' ^CD, [2023-12-03T13:01:10.255619 #2155288] DEBUG -- : Got INT signal I, [2023-12-03T13:01:10.255712 #2155288] INFO -- : Shutting down I, [2023-12-03T13:01:10.258483 #2155288] INFO -- : Finished 'Sync ethscriptions' duration_ms=2257 error=nil

RogerPodacter commented 10 months ago

Hi!

This error means that your DB's state is out of sync with the API server's. Typically this is caused by a re-org and should resolve itself with a retry automatically.

If it does not, try rails console and then in the console running EthscriptionSync.check_for_reorgs.

Also make sure that rspec works and this isn't a symptom of another problem.

Let me know if this works! Thanks for reporting!

cebook commented 10 months ago

The problem was solved because I modified the pgsql configuration in config/database.yml and created the database myself. When I restored the configuration and created the database with rails db:create There was no problem. Thank you very much.Tom