Skip to content

Commit

Permalink
add etnaActivationTime (#2373)
Browse files Browse the repository at this point in the history
* add etnaActivationTime

* changed to time.Time{}

* use time.Time{}

---------

Co-authored-by: sukantoraymond <rsukanto@umich.edu>
  • Loading branch information
arturrez and sukantoraymond authored Nov 25, 2024
1 parent 9409ef2 commit df2d5e2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions pkg/constants/etna.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package constants
import (
_ "embed"
"time"

avagoconstants "github.com/ava-labs/avalanchego/utils/constants"
)

//go:embed etnaDevnet/genesis.json
Expand Down Expand Up @@ -36,3 +38,8 @@ var (
)

const StakingEtnaMinimumDuration = 100 * time.Second

var EtnaActivationTime = map[uint32]time.Time{
avagoconstants.FujiID: time.Date(2024, time.November, 25, 16, 0, 0, 0, time.UTC),
EtnaDevnetNetworkID: time.Date(2024, time.October, 9, 20, 0, 0, 0, time.UTC),
}
13 changes: 7 additions & 6 deletions sdk/interchain/signature-aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import (
"os"
"time"

"github.com/ava-labs/avalanche-cli/pkg/constants"
"github.com/ava-labs/avalanche-cli/pkg/models"
"github.com/ava-labs/avalanchego/api/info"
"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/message"
"github.com/ava-labs/avalanchego/utils/constants"
avagoconstants "github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/vms/platformvm/warp"
apiConfig "github.com/ava-labs/awm-relayer/config"
Expand All @@ -30,8 +31,6 @@ const (
DefaultSignatureCacheSize = uint64(1024 * 1024)
)

var etnaTime = time.Unix(0, 0)

type SignatureAggregator struct {
subnetID ids.ID
quorumPercentage uint64
Expand Down Expand Up @@ -87,6 +86,7 @@ func initSignatureAggregator(
registerer prometheus.Registerer,
subnetID ids.ID,
quorumPercentage uint64,
etnaTime time.Time,
) (*SignatureAggregator, error) {
sa := &SignatureAggregator{}
// set quorum percentage
Expand All @@ -101,8 +101,8 @@ func initSignatureAggregator(
messageCreator, err := message.NewCreator(
logger,
registerer,
constants.DefaultNetworkCompressionType,
constants.DefaultNetworkMaximumInboundTimeout,
avagoconstants.DefaultNetworkCompressionType,
avagoconstants.DefaultNetworkMaximumInboundTimeout,
)
if err != nil {
return nil, fmt.Errorf("failed to create message creator: %w", err)
Expand Down Expand Up @@ -153,7 +153,8 @@ func NewSignatureAggregator(
logging.JSON.ConsoleEncoder(),
),
)
return initSignatureAggregator(peerNetwork, logger, registerer, subnetID, quorumPercentage)
etnaTime := constants.EtnaActivationTime[network.ID]
return initSignatureAggregator(peerNetwork, logger, registerer, subnetID, quorumPercentage, etnaTime)
}

// AggregateSignatures aggregates signatures for a given message and justification.
Expand Down
2 changes: 2 additions & 0 deletions sdk/interchain/signature-aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package interchain

import (
"testing"
"time"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/logging"
Expand All @@ -29,6 +30,7 @@ func instantiateAggregator(t *testing.T) (
prometheus.DefaultRegisterer,
subnetID,
DefaultQuorumPercentage,
time.Time{},
)
require.Equal(t, err, nil)
return aggregator, mockNetwork, err
Expand Down

0 comments on commit df2d5e2

Please sign in to comment.