Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugin/evm/message/block_sync_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type BlockSyncSummary struct {
BlockNumber uint64 `serialize:"true"`
BlockHash common.Hash `serialize:"true"`
BlockRoot common.Hash `serialize:"true"`
// ADD A FIELD FOR FIREWOOD IF NEEDED

summaryID ids.ID
bytes []byte
Expand Down
3 changes: 2 additions & 1 deletion plugin/evm/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"github.com/ava-labs/coreth/plugin/evm/message"
"github.com/ava-labs/coreth/plugin/evm/upgrade/acp176"
"github.com/ava-labs/coreth/plugin/evm/vmerrors"
"github.com/ava-labs/coreth/plugin/evm/vmsync"

Check failure on line 75 in plugin/evm/vm.go

View workflow job for this annotation

GitHub Actions / Lint

could not import github.com/ava-labs/coreth/plugin/evm/vmsync (-: # github.com/ava-labs/coreth/plugin/evm/vmsync
"github.com/ava-labs/coreth/precompile/precompileconfig"
"github.com/ava-labs/coreth/rpc"
"github.com/ava-labs/coreth/sync/client/stats"
Expand Down Expand Up @@ -643,6 +643,7 @@

// Initialize the state sync client
vm.Client = vmsync.NewClient(&vmsync.ClientConfig{
// Static or Dynamic
StateSyncDone: vm.stateSyncDone,
Chain: vm.eth,
State: vm.State,
Expand Down Expand Up @@ -864,7 +865,7 @@
case <-ctx.Done():
return 0, ctx.Err()
case <-vm.stateSyncDone:
return commonEng.StateSyncDone, nil
return commonEng.StateSyncDone, nil // modify to return a height/block hash
case <-vm.shutdownChan:
return commonEng.Message(0), errShuttingDownVM
}
Expand Down
20 changes: 20 additions & 0 deletions plugin/evm/vmsync/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,26 @@
return block.StateSyncStatic, nil
}

func (client *Client) UpdateSyncTarget(t T/* per block info */) error {
client.lock.Lock()
defer client.lock.Unlock()
if !currentlySyncing {
return err
}
if currentlyFinalizing {
return nil
// will only work if we tell the engine where to bootstrap from
// Otherwise, we add to queue
}
If t.Height % interval == 0 {

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-22.04)

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / e2e warp tests

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: unexpected name t at end of statement

Check failure on line 298 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

syntax error: unexpected name t at end of statement
client.t == t
return registry.UpdateTarget(t)
}

return nil

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-22.04)

syntax error: non-declaration statement outside function body

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (macos-latest)

syntax error: non-declaration statement outside function body

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / e2e warp tests

syntax error: non-declaration statement outside function body

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Lint

syntax error: non-declaration statement outside function body) (typecheck)

Check failure on line 303 in plugin/evm/vmsync/client.go

View workflow job for this annotation

GitHub Actions / Golang Unit Tests (ubuntu-latest)

syntax error: non-declaration statement outside function body
}


func (client *client) Shutdown() error {
if client.cancel != nil {
client.cancel()
Expand Down
6 changes: 6 additions & 0 deletions plugin/evm/wrapped_block.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func (b *wrappedBlock) ID() ids.ID { return b.id }
// Accept implements the snowman.Block interface
func (b *wrappedBlock) Accept(context.Context) error {
vm := b.vm
if currentlyDynamicSyncing() {
return vm.client.UpdateSyncTarget( /* WHAT IS THIS*/ )
}
// Although returning an error from Accept is considered fatal, it is good
// practice to cleanup the batch we were modifying in the case of an error.
defer vm.versiondb.Abort()
Expand Down Expand Up @@ -248,6 +251,9 @@ func (b *wrappedBlock) VerifyWithContext(_ context.Context, proposerVMBlockCtx *
// Enforces that the predicates are valid within [predicateContext].
// Writes the block details to disk and the state to the trie manager iff writes=true.
func (b *wrappedBlock) verify(predicateContext *precompileconfig.PredicateContext, writes bool) error {
if currentlyDynamicSyncing() {
return nil
}
if predicateContext.ProposerVMBlockCtx != nil {
log.Debug("Verifying block with context", "block", b.ID(), "height", b.Height())
} else {
Expand Down
Loading