Skip to content

Commit

Permalink
conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Aug 15, 2024
2 parents 5f2bb5f + 8264fe5 commit 0aaba69
Show file tree
Hide file tree
Showing 41 changed files with 561 additions and 517 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-nightly-performance-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: "INSTALL:NODEJS"
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: "START:LOCAL:NET:WITH:STATE"
run: |
Expand Down Expand Up @@ -102,7 +102,7 @@ jobs:
artillery report report.json --output artillery_report.html
- name: "UPLOAD:REPORT"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: artillery-report
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
core.setOutput('SOLANA_TESTS', labels.includes('SOLANA_TESTS'));
} else if (context.eventName === 'merge_group') {
core.setOutput('DEFAULT_TESTS', true);
core.setOutput('UPGRADE_LIGHT_TESTS', true);
} else if (context.eventName === 'push' && context.ref === 'refs/heads/develop') {
core.setOutput('DEFAULT_TESTS', true);
} else if (context.eventName === 'push' && context.ref.startsWith('refs/heads/release/')) {
Expand All @@ -112,6 +113,7 @@ jobs:
core.setOutput('ADMIN_TESTS', true);
core.setOutput('PERFORMANCE_TESTS', true);
core.setOutput('STATEFUL_DATA_TESTS', true);
core.setOutput('TSS_MIGRATION_TESTS', true);
core.setOutput('SOLANA_TESTS', true);
} else if (context.eventName === 'workflow_dispatch') {
core.setOutput('DEFAULT_TESTS', context.payload.inputs['default-test']);
Expand Down Expand Up @@ -197,6 +199,7 @@ jobs:
const cleanName = job.name.split("/")[0];
return `${icon} ${cleanName}`;
});
e2eResults.sort();
const overallResultStr = '${{ needs.e2e.result }}';
const overallResultPassing = overallResultStr === 'success' || overallResultStr === 'skipped';
Expand Down
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* [2634](https://github.com/zeta-chain/node/pull/2634) - add support for EIP-1559 gas fees
* [2597](https://github.com/zeta-chain/node/pull/2597) - Add generic rpc metrics to zetaclient
* [2538](https://github.com/zeta-chain/node/pull/2538) - add background worker routines to shutdown zetaclientd when needed for tss migration
* [2644](https://github.com/zeta-chain/node/pull/2644) - add created_timestamp to cctx status

### Refactor

Expand Down Expand Up @@ -133,6 +134,7 @@
* [2481](https://github.com/zeta-chain/node/pull/2481) - increase gas limit inbound and outbound vote message to 500k
* [2545](https://github.com/zeta-chain/node/pull/2545) - check solana minimum rent exempt to avoid outbound failure
* [2547](https://github.com/zeta-chain/node/pull/2547) - limit max txs in priority mempool
* [2628](https://github.com/zeta-chain/node/pull/2628) - avoid submitting invalid hashes to outbound tracker

### CI

Expand Down
4 changes: 0 additions & 4 deletions cmd/zetaclientd-supervisor/lib.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ type zetaclientdSupervisor struct {
upgradesDir string
upgradePlanName string
enableAutoDownload bool
restartChan chan os.Signal
}

func newZetaclientdSupervisor(
Expand All @@ -83,15 +82,12 @@ func newZetaclientdSupervisor(
if err != nil {
return nil, fmt.Errorf("grpc dial: %w", err)
}
// these signals will result in the supervisor process only restarting zetaclientd
restartChan := make(chan os.Signal, 1)
return &zetaclientdSupervisor{
zetacoredConn: conn,
logger: logger,
reloadSignals: make(chan bool, 1),
upgradesDir: defaultUpgradesDir,
enableAutoDownload: enableAutoDownload,
restartChan: restartChan,
}, nil
}

Expand Down
5 changes: 1 addition & 4 deletions cmd/zetaclientd-supervisor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ func main() {
os.Exit(1)
}
supervisor.Start(ctx)
// listen for SIGHUP to trigger a restart of zetaclientd
signal.Notify(supervisor.restartChan, syscall.SIGHUP)

shouldRestart := true
for shouldRestart {
Expand Down Expand Up @@ -81,15 +79,14 @@ func main() {
})
eg.Go(func() error {
supervisor.WaitForReloadSignal(ctx)
cancel()
return nil
})
eg.Go(func() error {
for {
select {
case <-ctx.Done():
return nil
case sig := <-supervisor.restartChan:
logger.Info().Msgf("got signal %d, sending SIGINT to zetaclientd", sig)
case sig := <-shutdownChan:
logger.Info().Msgf("got signal %d, shutting down", sig)
shouldRestart = false
Expand Down
7 changes: 6 additions & 1 deletion cmd/zetae2e/local/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
flagTestTSSMigration = "test-tss-migration"
flagSkipBitcoinSetup = "skip-bitcoin-setup"
flagSkipHeaderProof = "skip-header-proof"
flagSkipTrackerCheck = "skip-tracker-check"
)

var (
Expand Down Expand Up @@ -73,6 +74,7 @@ func NewLocalCmd() *cobra.Command {
cmd.Flags().Bool(flagSkipBitcoinSetup, false, "set to true to skip bitcoin wallet setup")
cmd.Flags().Bool(flagSkipHeaderProof, false, "set to true to skip header proof tests")
cmd.Flags().Bool(flagTestTSSMigration, false, "set to true to include a migration test at the end")
cmd.Flags().Bool(flagSkipTrackerCheck, false, "set to true to skip tracker check at the end of the tests")

return cmd
}
Expand All @@ -94,6 +96,7 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
skipSetup = must(cmd.Flags().GetBool(flagSkipSetup))
skipBitcoinSetup = must(cmd.Flags().GetBool(flagSkipBitcoinSetup))
skipHeaderProof = must(cmd.Flags().GetBool(flagSkipHeaderProof))
skipTrackerCheck = must(cmd.Flags().GetBool(flagSkipTrackerCheck))
testTSSMigration = must(cmd.Flags().GetBool(flagTestTSSMigration))
)

Expand Down Expand Up @@ -355,7 +358,9 @@ func localE2ETest(cmd *cobra.Command, _ []string) {
runTSSMigrationTest(deployerRunner, logger, verbose, conf)
}
// Verify that there are no trackers left over after tests complete
deployerRunner.EnsureNoTrackers()
if !skipTrackerCheck {
deployerRunner.EnsureNoTrackers()
}
// print and validate report
networkReport, err := deployerRunner.GenerateNetworkReport()
if err != nil {
Expand Down
13 changes: 6 additions & 7 deletions contrib/localnet/orchestrator/start-zetae2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then

# set upgrade height to 225 by default
UPGRADE_HEIGHT=${UPGRADE_HEIGHT:=225}
OLD_VERSION=$(get_zetacored_version)
COMMON_ARGS="--skip-header-proof --skip-tracker-check"

if [[ ! -f deployed.yml ]]; then
zetae2e local $E2E_ARGS --setup-only --config config.yml --config-out deployed.yml --skip-header-proof
zetae2e local $E2E_ARGS --setup-only --config config.yml --config-out deployed.yml ${COMMON_ARGS}
if [ $? -ne 0 ]; then
echo "e2e setup failed"
exit 1
Expand All @@ -115,17 +117,14 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then
echo "running E2E command to setup the networks and populate the state..."

# Use light flag to ensure tests can complete before the upgrade height
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light --skip-header-proof
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light ${COMMON_ARGS}
if [ $? -ne 0 ]; then
echo "first e2e failed"
exit 1
fi
fi

echo "Waiting for upgrade height..."

OLD_VERSION=$(get_zetacored_version)

CURRENT_HEIGHT=0
WAIT_HEIGHT=$(( UPGRADE_HEIGHT - 1 ))
# wait for upgrade height
Expand Down Expand Up @@ -157,9 +156,9 @@ if [ "$LOCALNET_MODE" == "upgrade" ]; then
# When the upgrade height is greater than 100 for upgrade test, the Bitcoin tests have been run once, therefore the Bitcoin wallet is already set up
# Use light flag to skip advanced tests
if [ "$UPGRADE_HEIGHT" -lt 100 ]; then
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light --skip-header-proof
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --light ${COMMON_ARGS}
else
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light --skip-header-proof
zetae2e local $E2E_ARGS --skip-setup --config deployed.yml --skip-bitcoin-setup --light ${COMMON_ARGS}
fi

ZETAE2E_EXIT_CODE=$?
Expand Down
4 changes: 4 additions & 0 deletions docs/openapi/openapi.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58426,6 +58426,10 @@ definitions:
format: int64
isAbortRefunded:
type: boolean
created_timestamp:
type: string
format: int64
description: when the CCTX was created. only populated on new transactions.
zetacoreemissionsParams:
type: object
properties:
Expand Down
2 changes: 1 addition & 1 deletion e2e/utils/zetacore.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const (
AdminPolicyName = "admin"
OperationalPolicyName = "operational"

DefaultCctxTimeout = 4 * time.Minute
DefaultCctxTimeout = 6 * time.Minute
)

// WaitCctxMinedByInboundHash waits until cctx is mined; returns the cctxIndex (the last one)
Expand Down
6 changes: 6 additions & 0 deletions pkg/constant/constant.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package constant

import "time"

const (
// ZetaBlockTime is the block time of the ZetaChain network
// It's a rough estimate that can be used in non-critical path to estimate the time of a block
ZetaBlockTime = 6000 * time.Millisecond

// DonationMessage is the message for donation transactions
// Transaction sent to the TSS or ERC20 Custody address containing this message are considered as a donation
DonationMessage = "I am rich!"
Expand Down
2 changes: 2 additions & 0 deletions proto/zetachain/zetacore/crosschain/cross_chain_tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ message Status {
string status_message = 2;
int64 lastUpdate_timestamp = 3;
bool isAbortRefunded = 4;
// when the CCTX was created. only populated on new transactions.
int64 created_timestamp = 5;
}

message CrossChainTx {
Expand Down
5 changes: 4 additions & 1 deletion testutil/sample/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,13 @@ func OutboundParamsValidChainID(r *rand.Rand) *types.OutboundParams {
func Status(t *testing.T, index string) *types.Status {
r := newRandFromStringSeed(t, index)

createdAt := r.Int63()

return &types.Status{
Status: types.CctxStatus(r.Intn(100)),
StatusMessage: String(),
LastUpdateTimestamp: r.Int63(),
CreatedTimestamp: createdAt,
LastUpdateTimestamp: createdAt,
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,13 @@ export declare class Status extends Message<Status> {
*/
isAbortRefunded: boolean;

/**
* when the CCTX was created. only populated on new transactions.
*
* @generated from field: int64 created_timestamp = 5;
*/
createdTimestamp: bigint;

constructor(data?: PartialMessage<Status>);

static readonly runtime: typeof proto3;
Expand Down
1 change: 0 additions & 1 deletion x/crosschain/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ func CheckAndUpdateCctxGasPrice(
// set new gas price and last update timestamp
cctx.GetCurrentOutboundParam().GasPrice = newGasPrice.String()
cctx.GetCurrentOutboundParam().GasPriorityFee = newPriorityFee.String()
cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix()
k.SetCrossChainTx(ctx, cctx)

return gasPriceIncrease, additionalFees, nil
Expand Down
9 changes: 9 additions & 0 deletions x/crosschain/keeper/abci_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "a1",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand All @@ -152,6 +153,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "a2",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand Down Expand Up @@ -180,6 +182,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "a3",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand Down Expand Up @@ -208,6 +211,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "b0",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand Down Expand Up @@ -235,6 +239,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "b1",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand All @@ -257,6 +262,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "b2",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand All @@ -279,6 +285,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "b3",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand All @@ -301,6 +308,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "c1",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand All @@ -322,6 +330,7 @@ func TestCheckAndUpdateCctxGasPrice(t *testing.T) {
cctx: types.CrossChainTx{
Index: "c2",
CctxStatus: &types.Status{
CreatedTimestamp: sampleTimestamp.Unix(),
LastUpdateTimestamp: sampleTimestamp.Unix(),
},
OutboundParams: []*types.OutboundParams{
Expand Down
5 changes: 5 additions & 0 deletions x/crosschain/keeper/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ func (k Keeper) SetCctxAndNonceToCctxAndInboundHashToCctx(ctx sdk.Context, cctx

// SetCrossChainTx set a specific send in the store from its index
func (k Keeper) SetCrossChainTx(ctx sdk.Context, cctx types.CrossChainTx) {
// only set the update timestamp if the block height is >0 to allow
// for a genesis import
if cctx.CctxStatus != nil && ctx.BlockHeight() > 0 {
cctx.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix()
}
p := types.KeyPrefix(fmt.Sprintf("%s", types.CCTXKey))
store := prefix.NewStore(ctx.KVStore(k.storeKey), p)
b := k.cdc.MustMarshal(&cctx)
Expand Down
3 changes: 3 additions & 0 deletions x/crosschain/keeper/grpc_query_cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,5 +283,8 @@ func TestKeeper_CctxByNonce(t *testing.T) {
})
require.NoError(t, err)
require.Equal(t, cctx, res.CrossChainTx)

// ensure that LastUpdateTimestamp is set to current block time
require.Equal(t, res.CrossChainTx.CctxStatus.LastUpdateTimestamp, ctx.BlockTime().Unix())
})
}
2 changes: 2 additions & 0 deletions x/crosschain/keeper/msg_server_abort_stuck_cctx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ func TestMsgServer_AbortStuckCCTX(t *testing.T) {
require.True(t, found)
require.Equal(t, crosschaintypes.CctxStatus_Aborted, cctxFound.CctxStatus.Status)
require.Equal(t, crosschainkeeper.AbortMessage, cctxFound.CctxStatus.StatusMessage)
// ensure the last update timestamp is updated
require.Equal(t, cctxFound.CctxStatus.LastUpdateTimestamp, ctx.BlockTime().Unix())
})

t.Run("can abort a cctx in pending revert", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/keeper/msg_server_refund_aborted_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (k msgServer) RefundAbortedCCTX(
commit()

// set the cctx as refunded
cctx.CctxStatus.AbortRefunded(ctx.BlockTime().Unix())
cctx.CctxStatus.AbortRefunded()

k.SetCrossChainTx(ctx, cctx)

Expand Down
2 changes: 1 addition & 1 deletion x/crosschain/types/cctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func (m *CrossChainTx) AddOutbound(
m.GetCurrentOutboundParam().EffectiveGasPrice = msg.ObservedOutboundEffectiveGasPrice
m.GetCurrentOutboundParam().EffectiveGasLimit = msg.ObservedOutboundEffectiveGasLimit
m.GetCurrentOutboundParam().ObservedExternalHeight = msg.ObservedOutboundBlockHeight
m.CctxStatus.LastUpdateTimestamp = ctx.BlockHeader().Time.Unix()
return nil
}

Expand Down Expand Up @@ -211,6 +210,7 @@ func NewCCTX(ctx sdk.Context, msg MsgVoteInbound, tssPubkey string) (CrossChainT
status := &Status{
Status: CctxStatus_PendingInbound,
StatusMessage: "",
CreatedTimestamp: ctx.BlockHeader().Time.Unix(),
LastUpdateTimestamp: ctx.BlockHeader().Time.Unix(),
IsAbortRefunded: false,
}
Expand Down
Loading

0 comments on commit 0aaba69

Please sign in to comment.