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

Precompile improvements merge #513

Merged
merged 28 commits into from
Feb 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bec556f
Light client mode to unlock dynamic state sync (#424)
darioush Jan 10, 2023
91f5897
Fix: typos (#428)
omahs Jan 10, 2023
197add9
Bump to v0.4.8 and bump AvalancheGo dependency to v1.9.6 (#429)
aaronbuchwald Jan 11, 2023
880ec77
Add requirement that Subnet-evm upgrade is enabled at genesis (#419)
anusha-ctrl Jan 13, 2023
adb9529
Add release checklist template (#435)
aaronbuchwald Jan 23, 2023
0a2e17e
Bump avalanchego dep to v1.9.7 and start v0.4.9 release cycle (#433)
aaronbuchwald Jan 23, 2023
dbc1b4d
Coreth 0.11.6 sync (#436)
ceyonur Jan 23, 2023
a584fca
Refactor e2e tests (#425)
aaronbuchwald Jan 26, 2023
13d49a7
Improve version output (#463)
aaronbuchwald Jan 28, 2023
d1cbe9d
nil timestamp in genesis should be upgradeable (#461)
darioush Jan 28, 2023
76e3fe2
release locks on return (#470)
darioush Jan 30, 2023
954fe72
- Adding missing import "encoding/json" (used in Stringer-method) (#465)
itinance Jan 31, 2023
01a16a0
fix allow list comments (#469)
ceyonur Jan 31, 2023
009c86f
add nil checks (#473)
ceyonur Feb 1, 2023
1955873
Warp backend interface and implementation (#452)
Feb 1, 2023
5dfa34f
Add documentation section to PR template (#484)
aaronbuchwald Feb 3, 2023
7aa90d0
remove current rules (#481)
ceyonur Feb 5, 2023
7887607
add documentation guidelines (#486)
darioush Feb 6, 2023
c667f95
parseInt from ENV var (#491)
ceyonur Feb 6, 2023
50da2fd
Add generate precompile script to fix CGO flags issue (#489)
aaronbuchwald Feb 6, 2023
fe5e55c
try to fix lint job (#499)
darioush Feb 8, 2023
40c5212
build with avago v1.9.8 (#498)
cam-schultz Feb 8, 2023
0731a82
Signature Request Handler (#459)
Feb 9, 2023
8343e42
Update codeowners (#492)
aaronbuchwald Feb 9, 2023
38ad7f5
Get signature endpoint: alternative PR with different packaging (#507)
darioush Feb 10, 2023
75a5709
Merge branch 'master' into precompile-improvements-main
aaronbuchwald Feb 16, 2023
4ee9802
Fix regression test added prior to merge
aaronbuchwald Feb 16, 2023
93d274f
Fix fee manager invalid fee config test
aaronbuchwald Feb 16, 2023
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
Next Next commit
Light client mode to unlock dynamic state sync (#424)
* Light client mode to unlock dynamic state sync

* revert version to pass ci (?)

* fix simulator go.mod
  • Loading branch information
darioush authored Jan 10, 2023
commit bec556fb24530f12b13f25f01316c8af35d96bab
4 changes: 2 additions & 2 deletions cmd/simulator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ replace github.com/ava-labs/subnet-evm => ../..

require (
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
github.com/ava-labs/avalanchego v1.9.5 // indirect
github.com/ava-labs/avalanchego v1.9.6-rc.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
Expand Down Expand Up @@ -62,7 +62,7 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect
golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5 // indirect
golang.org/x/net v0.1.0 // indirect
Expand Down
9 changes: 4 additions & 5 deletions cmd/simulator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,13 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8=
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/ava-labs/avalanchego v1.9.5 h1:0uykbcKFocUL7U7SO/PGrXSMLX9RSt8xo5rj84bI3YY=
github.com/ava-labs/avalanchego v1.9.5/go.mod h1:1f/z4CBcz/VhNlOTj607dQj5ZQQaZQO/RO8sEa0EgvA=
github.com/ava-labs/avalanchego v1.9.6-rc.0 h1:Jo5h3fbMV7C9CSNCrEgv6tZjRP6iPakcMiUDtyLhPS0=
github.com/ava-labs/avalanchego v1.9.6-rc.0/go.mod h1:L9mYGihm43ccnslbRGAUIbJ7pM9IIjqHjWx4xIcp298=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/btcsuite/btcd v0.23.1 h1:IB8cVQcC2X5mHbnfirLG5IZnkWYNTPlLZVrxUYSotbE=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down Expand Up @@ -363,8 +362,8 @@ go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.18
require (
github.com/VictoriaMetrics/fastcache v1.10.0
github.com/ava-labs/avalanche-network-runner-sdk v0.3.0
github.com/ava-labs/avalanchego v1.9.5
github.com/ava-labs/avalanchego v1.9.6-rc.0
github.com/cespare/cp v0.1.0
github.com/creack/pty v1.1.18
github.com/davecgh/go-spew v1.1.1
Expand Down Expand Up @@ -118,7 +118,7 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/exp v0.0.0-20220426173459-3bcf042a4bf5 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/term v0.1.0 // indirect
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,15 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd
github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0=
github.com/ava-labs/avalanche-network-runner-sdk v0.3.0 h1:TVi9JEdKNU/RevYZ9PyW4pULbEdS+KQDA9Ki2DUvuAs=
github.com/ava-labs/avalanche-network-runner-sdk v0.3.0/go.mod h1:SgKJvtqvgo/Bl/c8fxEHCLaSxEbzimYfBopcfrajxQk=
github.com/ava-labs/avalanchego v1.9.5 h1:0uykbcKFocUL7U7SO/PGrXSMLX9RSt8xo5rj84bI3YY=
github.com/ava-labs/avalanchego v1.9.5/go.mod h1:1f/z4CBcz/VhNlOTj607dQj5ZQQaZQO/RO8sEa0EgvA=
github.com/ava-labs/avalanchego v1.9.6-rc.0 h1:Jo5h3fbMV7C9CSNCrEgv6tZjRP6iPakcMiUDtyLhPS0=
github.com/ava-labs/avalanchego v1.9.6-rc.0/go.mod h1:L9mYGihm43ccnslbRGAUIbJ7pM9IIjqHjWx4xIcp298=
github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/btcsuite/btcd v0.23.1 h1:IB8cVQcC2X5mHbnfirLG5IZnkWYNTPlLZVrxUYSotbE=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
Expand Down Expand Up @@ -578,8 +577,8 @@ go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/
go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8=
go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.23.0 h1:OjGQ5KQDEUawVHxNwQgPpiypGHOxo2mNZsOqTak4fFY=
go.uber.org/zap v1.23.0/go.mod h1:D+nX8jyLsMHMYrln8A0rJjFt/T/9/bGgIhAqxv5URuY=
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
8 changes: 4 additions & 4 deletions plugin/evm/message/syncable.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ type SyncSummary struct {

summaryID ids.ID
bytes []byte
acceptImpl func(SyncSummary) (bool, error)
acceptImpl func(SyncSummary) (block.StateSyncMode, error)
}

func NewSyncSummaryFromBytes(summaryBytes []byte, acceptImpl func(SyncSummary) (bool, error)) (SyncSummary, error) {
func NewSyncSummaryFromBytes(summaryBytes []byte, acceptImpl func(SyncSummary) (block.StateSyncMode, error)) (SyncSummary, error) {
summary := SyncSummary{}
if codecVersion, err := Codec.Unmarshal(summaryBytes, &summary); err != nil {
return SyncSummary{}, err
Expand Down Expand Up @@ -83,9 +83,9 @@ func (s SyncSummary) String() string {
return fmt.Sprintf("SyncSummary(BlockHash=%s, BlockNumber=%d, BlockRoot=%s)", s.BlockHash, s.BlockNumber, s.BlockRoot)
}

func (s SyncSummary) Accept(context.Context) (bool, error) {
func (s SyncSummary) Accept(context.Context) (block.StateSyncMode, error) {
if s.acceptImpl == nil {
return false, fmt.Errorf("accept implementation not specified for summary: %s", s)
return block.StateSyncSkipped, fmt.Errorf("accept implementation not specified for summary: %s", s)
}
return s.acceptImpl(s)
}
12 changes: 6 additions & 6 deletions plugin/evm/syncervm_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (client *stateSyncerClient) stateSync(ctx context.Context) error {

// acceptSyncSummary returns true if sync will be performed and launches the state sync process
// in a goroutine.
func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncSummary) (bool, error) {
func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncSummary) (block.StateSyncMode, error) {
isResume := proposedSummary.BlockHash == client.resumableSummary.BlockHash
if !isResume {
// Skip syncing if the blockchain is not significantly ahead of local state,
Expand All @@ -167,12 +167,12 @@ func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncS
"syncableHeight", proposedSummary.Height(),
)
if err := client.StateSyncClearOngoingSummary(); err != nil {
return false, fmt.Errorf("failed to clear ongoing summary after skipping state sync: %w", err)
return block.StateSyncSkipped, fmt.Errorf("failed to clear ongoing summary after skipping state sync: %w", err)
}
// Initialize snapshots if we're skipping state sync, since it will not have been initialized on
// startup.
client.chain.BlockChain().InitializeSnapshots()
return false, nil
return block.StateSyncSkipped, nil
}

// Wipe the snapshot completely if we are not resuming from an existing sync, so that we do not
Expand All @@ -193,10 +193,10 @@ func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncS
// Note: this must be performed after WipeSnapshot finishes so that we do not start a state sync
// session from a partially wiped snapshot.
if err := client.metadataDB.Put(stateSyncSummaryKey, proposedSummary.Bytes()); err != nil {
return false, fmt.Errorf("failed to write state sync summary key to disk: %w", err)
return block.StateSyncSkipped, fmt.Errorf("failed to write state sync summary key to disk: %w", err)
}
if err := client.db.Commit(); err != nil {
return false, fmt.Errorf("failed to commit db: %w", err)
return block.StateSyncSkipped, fmt.Errorf("failed to commit db: %w", err)
}

log.Info("Starting state sync", "summary", proposedSummary)
Expand All @@ -220,7 +220,7 @@ func (client *stateSyncerClient) acceptSyncSummary(proposedSummary message.SyncS
log.Info("stateSync completed, notifying engine", "err", client.stateSyncErr)
client.toEngine <- commonEng.StateSyncDone
}()
return true, nil
return block.StateSyncStatic, nil
}

// syncBlocks fetches (up to) [parentsToGet] blocks from peers
Expand Down
19 changes: 10 additions & 9 deletions plugin/evm/syncervm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/ava-labs/avalanchego/snow"
"github.com/ava-labs/avalanchego/snow/choices"
commonEng "github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
"github.com/ava-labs/avalanchego/utils/set"

"github.com/ava-labs/subnet-evm/accounts/keystore"
Expand All @@ -44,7 +45,7 @@ func TestSkipStateSync(t *testing.T) {
test := syncTest{
syncableInterval: 256,
stateSyncMinBlocks: 300, // must be greater than [syncableInterval] to skip sync
shouldSync: false,
syncMode: block.StateSyncSkipped,
}
vmSetup := createSyncServerAndClientVMs(t, test)
defer vmSetup.Teardown(t)
Expand All @@ -57,7 +58,7 @@ func TestStateSyncFromScratch(t *testing.T) {
test := syncTest{
syncableInterval: 256,
stateSyncMinBlocks: 50, // must be less than [syncableInterval] to perform sync
shouldSync: true,
syncMode: block.StateSyncStatic,
}
vmSetup := createSyncServerAndClientVMs(t, test)
defer vmSetup.Teardown(t)
Expand All @@ -78,7 +79,7 @@ func TestStateSyncToggleEnabledToDisabled(t *testing.T) {
test := syncTest{
syncableInterval: 256,
stateSyncMinBlocks: 50, // must be less than [syncableInterval] to perform sync
shouldSync: true,
syncMode: block.StateSyncStatic,
responseIntercept: func(syncerVM *VM, nodeID ids.NodeID, requestID uint32, response []byte) {
lock.Lock()
defer lock.Unlock()
Expand Down Expand Up @@ -107,7 +108,7 @@ func TestStateSyncToggleEnabledToDisabled(t *testing.T) {
// Perform sync resulting in early termination.
testSyncerVM(t, vmSetup, test)

test.shouldSync = true
test.syncMode = block.StateSyncStatic
test.responseIntercept = nil
test.expectedErr = nil

Expand Down Expand Up @@ -360,7 +361,7 @@ type syncTest struct {
responseIntercept func(vm *VM, nodeID ids.NodeID, requestID uint32, response []byte)
stateSyncMinBlocks uint64
syncableInterval uint64
shouldSync bool
syncMode block.StateSyncMode
expectedErr error
}

Expand Down Expand Up @@ -388,14 +389,14 @@ func testSyncerVM(t *testing.T, vmSetup *syncVMSetup, test syncTest) {
}
assert.Equal(t, summary, retrievedSummary)

shouldSync, err := parsedSummary.Accept(context.Background())
syncMode, err := parsedSummary.Accept(context.Background())
if err != nil {
t.Fatal("unexpected error accepting state summary", "err", err)
}
if shouldSync != test.shouldSync {
t.Fatal("unexpected value returned from accept", "expected", test.shouldSync, "got", shouldSync)
if syncMode != test.syncMode {
t.Fatal("unexpected value returned from accept", "expected", test.syncMode, "got", syncMode)
}
if !shouldSync {
if syncMode == block.StateSyncSkipped {
return
}
msg := <-syncerEngineChan
Expand Down