Skip to content

Commit

Permalink
bump avago to v1.12.0 (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceyonur authored Dec 5, 2024
1 parent ee040d0 commit 6c98da7
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
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.22.8
require (
github.com/VictoriaMetrics/fastcache v1.12.1
github.com/antithesishq/antithesis-sdk-go v0.3.8
github.com/ava-labs/avalanchego v1.11.13
github.com/ava-labs/avalanchego v1.12.0
github.com/cespare/cp v0.1.0
github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233
github.com/davecgh/go-spew v1.1.1
Expand Down Expand Up @@ -41,6 +41,7 @@ require (
github.com/urfave/cli/v2 v2.25.7
go.uber.org/goleak v1.3.0
go.uber.org/mock v0.4.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.26.0
golang.org/x/exp v0.0.0-20231127185646-65229373498e
golang.org/x/sync v0.8.0
Expand Down Expand Up @@ -153,7 +154,6 @@ require (
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.21.0 // indirect
golang.org/x/term v0.23.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ github.com/antithesishq/antithesis-sdk-go v0.3.8/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.11.13 h1:1lcDZ9ILZgeiv7IwL4TuFTyglgZMr9QBOnpLHX+Qy5k=
github.com/ava-labs/avalanchego v1.11.13/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/avalanchego v1.12.0 h1:NBx0vSOY1dCT0PeJzojIhNhx0NMQNem4GgTEN+v8Sx4=
github.com/ava-labs/avalanchego v1.12.0/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU=
github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo=
github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g=
Expand Down
5 changes: 1 addition & 4 deletions scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
# shellcheck disable=SC2034

# Don't export them as they're used in the context of other calls
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.11.13'}
AVALANCHE_VERSION=${AVALANCHE_VERSION:-'v1.12.0'}
GINKGO_VERSION=${GINKGO_VERSION:-'v2.2.0'}

# This won't be used, but it's here to make code syncs easier
LATEST_CORETH_VERSION='v0.13.7'
31 changes: 20 additions & 11 deletions tests/antithesis/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"crypto/ecdsa"
"crypto/rand"
"fmt"
"log"
"math/big"
"path/filepath"
"time"
Expand All @@ -18,6 +17,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/tests/antithesis"
Expand All @@ -31,13 +31,15 @@ import (
"github.com/ava-labs/subnet-evm/tests/utils"

ago_tests "github.com/ava-labs/avalanchego/tests"
"github.com/ava-labs/avalanchego/utils/logging"
timerpkg "github.com/ava-labs/avalanchego/utils/timer"
)

const NumKeys = 5

func main() {
tc := ago_tests.NewTestContext()
logger := ago_tests.NewDefaultLogger("")
tc := ago_tests.NewTestContext(logger)
defer tc.Cleanup()
require := require.New(tc)

Expand All @@ -60,7 +62,9 @@ func main() {
ctx := ago_tests.DefaultNotifyContext(c.Duration, tc.DeferCleanup)

require.Len(c.ChainIDs, 1)
log.Printf("CHAIN IDS: %v", c.ChainIDs)
logger.Info("Starting testing",
zap.Strings("chainIDs", c.ChainIDs),
)
chainID, err := ids.FromString(c.ChainIDs[0])
require.NoError(err, "failed to parse chainID")

Expand All @@ -69,6 +73,7 @@ func main() {
genesisKey := tmpnet.HardhatKey.ToECDSA()
genesisWorkload := &workload{
id: 0,
log: ago_tests.NewDefaultLogger(fmt.Sprintf("worker %d", 0)),
client: genesisClient,
key: genesisKey,
uris: c.URIs,
Expand All @@ -82,13 +87,14 @@ func main() {
key, err := crypto.ToECDSA(crypto.Keccak256([]byte{uint8(i)}))
require.NoError(err, "failed to generate key")

require.NoError(transferFunds(ctx, genesisClient, genesisKey, crypto.PubkeyToAddress(key.PublicKey), initialAmount))
require.NoError(transferFunds(ctx, genesisClient, genesisKey, crypto.PubkeyToAddress(key.PublicKey), initialAmount, logger))

client, err := ethclient.Dial(getChainURI(c.URIs[i%len(c.URIs)], chainID.String()))
require.NoError(err, "failed to dial chain")

workloads[i] = &workload{
id: i,
log: ago_tests.NewDefaultLogger(fmt.Sprintf("worker %d", i)),
client: client,
key: key,
uris: c.URIs,
Expand All @@ -109,14 +115,15 @@ func main() {
type workload struct {
id int
client ethclient.Client
log logging.Logger
key *ecdsa.PrivateKey
uris []string
}

func (w *workload) run(ctx context.Context) {
timer := timerpkg.StoppedTimer()

tc := ago_tests.NewTestContext()
tc := ago_tests.NewTestContext(w.log)
defer tc.Cleanup()
require := require.New(tc)

Expand All @@ -132,12 +139,14 @@ func (w *workload) run(ctx context.Context) {
for {
// TODO(marun) Exercise a wider variety of transactions
recipientEthAddress := crypto.PubkeyToAddress(w.key.PublicKey)
err := transferFunds(ctx, w.client, w.key, recipientEthAddress, txAmount)
err := transferFunds(ctx, w.client, w.key, recipientEthAddress, txAmount, w.log)
if err != nil {
// Log the error and continue since the problem may be
// transient. require.NoError is only for errors that should stop
// execution.
log.Printf("failed to transfer funds: %s", err)
w.log.Info("failed to transfer funds",
zap.Error(err),
)
}

val, err := rand.Int(rand.Reader, big.NewInt(int64(time.Second)))
Expand All @@ -156,7 +165,7 @@ func getChainURI(nodeURI string, blockchainID string) string {
return fmt.Sprintf("%s/ext/bc/%s/rpc", nodeURI, blockchainID)
}

func transferFunds(ctx context.Context, client ethclient.Client, key *ecdsa.PrivateKey, recipientAddress common.Address, txAmount uint64) error {
func transferFunds(ctx context.Context, client ethclient.Client, key *ecdsa.PrivateKey, recipientAddress common.Address, txAmount uint64, log logging.Logger) error {
chainID, err := client.ChainID(ctx)
if err != nil {
return fmt.Errorf("failed to fetch chainID: %w", err)
Expand Down Expand Up @@ -188,17 +197,17 @@ func transferFunds(ctx context.Context, client ethclient.Client, key *ecdsa.Priv
return fmt.Errorf("failed to format transaction: %w", err)
}

log.Printf("sending transaction with ID %s and nonce %d\n", tx.Hash(), acceptedNonce)
log.Info("sending transaction", zap.Stringer("txID", tx.Hash()), zap.Uint64("nonce", acceptedNonce))
err = client.SendTransaction(ctx, tx)
if err != nil {
return fmt.Errorf("failed to send transaction: %w", err)
}

log.Printf("waiting for acceptance of transaction with ID %s\n", tx.Hash())
log.Info("waiting for acceptance of transaction", zap.Stringer("txID", tx.Hash()))
if _, err := bind.WaitMined(ctx, client, tx); err != nil {
return fmt.Errorf("failed to wait for receipt: %v", err)
}
log.Printf("confirmed acceptance of transaction with ID %s\n", tx.Hash())
log.Info("confirmed acceptance of transaction", zap.Stringer("txID", tx.Hash()))

return nil
}
10 changes: 3 additions & 7 deletions tests/utils/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func CreateSubnetsSuite(genesisFiles map[string]string) *SubnetSuite {
// each test case. Each test case has its own subnet, therefore all tests
// can run in parallel without any issue.
//
var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
_ = ginkgo.SynchronizedBeforeSuite(func() []byte {
ctx, cancel := context.WithTimeout(context.Background(), BootAvalancheNodeTimeout)
defer cancel()

Expand Down Expand Up @@ -101,7 +101,7 @@ func CreateSubnetsSuite(genesisFiles map[string]string) *SubnetSuite {
// SynchronizedAfterSuite() takes two functions, the first runs after each test suite is done and the second
// function is executed once when all the tests are done. This function is used
// to gracefully shutdown the AvalancheGo node.
var _ = ginkgo.SynchronizedAfterSuite(func() {}, func() {
_ = ginkgo.SynchronizedAfterSuite(func() {}, func() {
require.NotNil(startCmd)
require.NoError(startCmd.Stop())
})
Expand All @@ -118,11 +118,7 @@ func CreateNewSubnet(ctx context.Context, genesisFilePath string) string {

// MakeWallet fetches the available UTXOs owned by [kc] on the network
// that [LocalAPIURI] is hosting.
wallet, err := wallet.MakeWallet(ctx, &wallet.WalletConfig{
URI: DefaultLocalNodeURI,
AVAXKeychain: kc,
EthKeychain: kc,
})
wallet, err := wallet.MakeWallet(ctx, DefaultLocalNodeURI, kc, kc, wallet.WalletConfig{})
require.NoError(err)

pWallet := wallet.P()
Expand Down

0 comments on commit 6c98da7

Please sign in to comment.