From db09032ad78097a67c698c06ed73fcf3fe00e9e3 Mon Sep 17 00:00:00 2001 From: dhrubabasu <7675102+dhrubabasu@users.noreply.github.com> Date: Tue, 9 Apr 2024 13:25:12 -0400 Subject: [PATCH] [vms/proposervm] Remove `getForkHeight` --- vms/proposervm/pre_fork_block.go | 2 +- vms/proposervm/vm.go | 26 +------------------------- 2 files changed, 2 insertions(+), 26 deletions(-) diff --git a/vms/proposervm/pre_fork_block.go b/vms/proposervm/pre_fork_block.go index 199c1c98db7d..a7c6e0c17832 100644 --- a/vms/proposervm/pre_fork_block.go +++ b/vms/proposervm/pre_fork_block.go @@ -39,7 +39,7 @@ func (b *preForkBlock) acceptInnerBlk(ctx context.Context) error { } func (b *preForkBlock) Status() choices.Status { - forkHeight, err := b.vm.getForkHeight() + forkHeight, err := b.vm.GetForkHeight() if err == database.ErrNotFound { return b.Block.Status() } diff --git a/vms/proposervm/vm.go b/vms/proposervm/vm.go index f211f25e706f..ccb07fec83f8 100644 --- a/vms/proposervm/vm.go +++ b/vms/proposervm/vm.go @@ -53,10 +53,6 @@ var ( _ block.BatchedChainVM = (*VM)(nil) _ block.StateSyncableVM = (*VM)(nil) - // TODO: remove after the X-chain supports height indexing. - mainnetXChainID = ids.FromStringOrPanic("2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM") - fujiXChainID = ids.FromStringOrPanic("2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm") - dbPrefix = []byte("proposervm") ) @@ -214,7 +210,7 @@ func (vm *VM) Initialize( return err } - forkHeight, err := vm.getForkHeight() + forkHeight, err := vm.GetForkHeight() switch err { case nil: chainCtx.Log.Info("initialized proposervm", @@ -575,26 +571,6 @@ func (vm *VM) getBlock(ctx context.Context, id ids.ID) (Block, error) { return vm.getPreForkBlock(ctx, id) } -// TODO: remove after the P-chain and X-chain support height indexing. -func (vm *VM) getForkHeight() (uint64, error) { - // The fork block can be easily identified with the provided links because - // the `Parent Hash` is equal to the `Proposer Parent ID`. - switch vm.ctx.ChainID { - case constants.PlatformChainID: - switch vm.ctx.NetworkID { - case constants.MainnetID: - return 805732, nil // https://subnets.avax.network/p-chain/block/805732 - case constants.FujiID: - return 47529, nil // https://subnets-test.avax.network/p-chain/block/47529 - } - case mainnetXChainID: - return 1, nil // https://subnets.avax.network/x-chain/block/1 - case fujiXChainID: - return 1, nil // https://subnets-test.avax.network/x-chain/block/1 - } - return vm.GetForkHeight() -} - func (vm *VM) getPostForkBlock(ctx context.Context, blkID ids.ID) (PostForkBlock, error) { block, exists := vm.verifiedBlocks[blkID] if exists {