Skip to content

Commit

Permalink
Cleanup after cortina merge, reduce diff with avax (#371)
Browse files Browse the repository at this point in the history
  • Loading branch information
evlekht authored Aug 7, 2024
1 parent 3b0d67a commit 05022a8
Show file tree
Hide file tree
Showing 20 changed files with 71 additions and 77 deletions.
27 changes: 3 additions & 24 deletions api/server/server.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down Expand Up @@ -137,21 +127,10 @@ func New(
}

router := newRouter()
corsOptions := cors.Options{
corsHandler := cors.New(cors.Options{
AllowedOrigins: allowedOrigins,
AllowCredentials: true,
}

// If and only if allowed origin only contains the wildcard, copy the hostname to the allow
// origins header
if len(allowedOrigins) == 1 && allowedOrigins[0] == "*" {
corsOptions.AllowOriginFunc = func(origin string) bool {
return true
}
} else {
corsOptions.AllowedOrigins = allowedOrigins
}

corsHandler := cors.New(corsOptions).Handler(router)
}).Handler(router)
gzipHandler := gziphandler.GzipHandler(corsHandler)
var handler http.Handler = http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
Expand Down
10 changes: 10 additions & 0 deletions codec/reflectcodec/struct_fielder.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2023-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
10 changes: 10 additions & 0 deletions config/keys.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
11 changes: 1 addition & 10 deletions main/main.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand All @@ -19,6 +9,7 @@ import (
"os"

"github.com/spf13/pflag"

"golang.org/x/term"

"github.com/ava-labs/avalanchego/app"
Expand Down
10 changes: 10 additions & 0 deletions node/config.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2023-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
10 changes: 0 additions & 10 deletions tests/e2e/banff/suites.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
10 changes: 0 additions & 10 deletions tests/e2e/p/permissionless_subnets.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
10 changes: 0 additions & 10 deletions tests/e2e/p/workflow.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
2 changes: 1 addition & 1 deletion tests/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
10 changes: 10 additions & 0 deletions version/compatibility_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
4 changes: 2 additions & 2 deletions version/constants_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (

func TestCurrentRPCChainVMCompatible(t *testing.T) {
compatibleVersions := RPCChainVMProtocolCompatibility[RPCChainVMProtocol]
for _, version := range compatibleVersions {
_ = version.String()
for _, ver := range compatibleVersions {
_ = ver.String()
}
require.Contains(t, compatibleVersions, Current)
}
File renamed without changes.
3 changes: 1 addition & 2 deletions vms/platformvm/api/static_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func bech32ToID(addrStr string) (ids.ShortID, error) {
// BuildGenesis build the genesis state of the Platform Chain (and thereby the Avalanche network.)
func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error {
// Specify the UTXOs on the Platform chain that exist at genesis.
var vdrs txheap.TimedHeap
if args.Camino != nil && args.Camino.LockModeBondDeposit {
return buildCaminoGenesis(args, reply)
}
Expand Down Expand Up @@ -257,7 +256,7 @@ func (*StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, repl
}

// Specify the validators that are validating the primary network at genesis.
vdrs = txheap.NewByEndTime()
vdrs := txheap.NewByEndTime()
for _, vdr := range args.Validators {
weight := uint64(0)
stake := make([]*avax.TransferableOutput, len(vdr.Staked))
Expand Down
2 changes: 0 additions & 2 deletions vms/platformvm/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

//go:generate mockgen -source cache_internal_state.go -destination mock_cache_internal_state.go -package platformvm -aux_files github.com/chain4travel/caminogo/vms/platformvm=cache_versioned_state.go,github.com/chain4travel/caminogo/vms/platformvm=cache_validator_state.go

package platformvm

import (
Expand Down
10 changes: 10 additions & 0 deletions vms/platformvm/txs/base_tx_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down
2 changes: 1 addition & 1 deletion vms/platformvm/txs/executor/proposal_tx_executor.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2022-2023, Chain4Travel AG. All rights reserved.
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
Expand Down
3 changes: 0 additions & 3 deletions vms/platformvm/txs/executor/state_changes.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ func AdvanceTimeTo(
if stakerToRemove.StartTime.After(newChainTime) {
break
}
if stakerToRemove.EndTime.Equal(stakerToRemove.StartTime) {
continue
}

stakerToAdd := *stakerToRemove
stakerToAdd.NextTime = stakerToRemove.EndTime
Expand Down
10 changes: 10 additions & 0 deletions vms/types/blob_data.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
// Copyright (C) 2022-2024, Chain4Travel AG. All rights reserved.
//
// This file is a derived work, based on ava-labs code whose
// original notices appear below.
//
// It is distributed under the same license conditions as the
// original code from which it is derived.
//
// Much love to the original authors for their work.
// **********************************************************
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.

Expand Down

0 comments on commit 05022a8

Please sign in to comment.