diff --git a/src/contract/HandlerBasedContract.ts b/src/contract/HandlerBasedContract.ts index cd23dc70..285c66b4 100644 --- a/src/contract/HandlerBasedContract.ts +++ b/src/contract/HandlerBasedContract.ts @@ -390,12 +390,7 @@ export class HandlerBasedContract implements Contract { tags.push(new Tag(WARP_TAGS.REQUEST_VRF, 'true')); } - const interactionTags = createInteractionTagsList( - this._contractTxId, - input, - this.warp.environment === 'testnet', - tags - ); + const interactionTags = createInteractionTagsList(this._contractTxId, input, tags); if (tagsExceedLimit(interactionTags)) { throw new Error(`Interaction tags exceed limit of 4096 bytes.`); @@ -452,7 +447,6 @@ export class HandlerBasedContract implements Contract { transfer.target, transfer.winstonQty, bundle, - this.warp.environment === 'testnet', reward ); @@ -767,8 +761,7 @@ export class HandlerBasedContract implements Contract { tags, transfer.target, transfer.winstonQty, - true, - this.warp.environment === 'testnet' + true ); const dummyTx = createDummyTx(tx, executionContext.caller, currentBlockData); diff --git a/src/core/ContractDefinition.ts b/src/core/ContractDefinition.ts index f26e207d..bb31aa49 100644 --- a/src/core/ContractDefinition.ts +++ b/src/core/ContractDefinition.ts @@ -42,7 +42,6 @@ export class ContractCache { manifest?: EvaluationManifest; contractTx: any; // eslint-disable-line @typescript-eslint/no-explicit-any srcTx: any; // eslint-disable-line @typescript-eslint/no-explicit-any - testnet: string | null; constructor(value: ContractDefinition) { this.txId = value.txId; @@ -55,7 +54,6 @@ export class ContractCache { this.metadata = value.metadata; this.contractTx = value.contractTx; this.srcTx = value.srcTx; - this.testnet = value.testnet; } } diff --git a/src/core/KnownTags.ts b/src/core/KnownTags.ts index f60b1363..fde4bfd3 100644 --- a/src/core/KnownTags.ts +++ b/src/core/KnownTags.ts @@ -38,7 +38,6 @@ export const WARP_TAGS = { REQUEST_VRF: 'Request-Vrf', SIGNATURE_TYPE: 'Signature-Type', UPLOADER_TX_ID: 'Uploader-Tx-Id', - WARP_TESTNET: 'Warp-Testnet', MANIFEST: 'Contract-Manifest', NONCE: 'Nonce' } as const; diff --git a/src/core/Warp.ts b/src/core/Warp.ts index 6db91439..441568bd 100644 --- a/src/core/Warp.ts +++ b/src/core/Warp.ts @@ -35,7 +35,7 @@ import { SourceData } from '../contract/deploy/Source'; import { Signer, DataItem } from 'warp-arbundles'; import { BasicSortKeyCache } from '../cache/BasicSortKeyCache'; -export type WarpEnvironment = 'local' | 'testnet' | 'seqtestnet' | 'mainnet' | 'custom'; +export type WarpEnvironment = 'local' | 'testnet' | 'mainnet' | 'custom'; export type KVStorageFactory = (contractTxId: string) => SortKeyCache; /** diff --git a/src/core/WarpFactory.ts b/src/core/WarpFactory.ts index 1008920f..3687d823 100644 --- a/src/core/WarpFactory.ts +++ b/src/core/WarpFactory.ts @@ -68,8 +68,8 @@ export class WarpFactory { } /** - * creates a Warp instance suitable for testing - * with Warp testnet (https://testnet.redstone.tools/) + * creates a Warp instance suitable for testing with Warp testnet and the decentralized Warp Sequencer + * (https://github.com/warp-contracts/sequencer) */ static forTestnet( cacheOptions = defaultCacheOptions, @@ -83,27 +83,7 @@ export class WarpFactory { if (useArweaveGw) { return this.customArweaveGw(arweave, cacheOptions, 'testnet'); } else { - return this.customWarpGw(arweave, defaultWarpGwOptions, cacheOptions, 'testnet'); - } - } - - /** - * creates a Warp instance suitable for testing the decentralized Warp Sequencer - * (https://github.com/warp-contracts/sequencer) - */ - static forSeqTestnet( - cacheOptions = defaultCacheOptions, - useArweaveGw = false, - arweave = Arweave.init({ - host: 'arweave.net', - port: 443, - protocol: 'https' - }) - ): Warp { - if (useArweaveGw) { - return this.customArweaveGw(arweave, cacheOptions, 'seqtestnet'); - } else { - return this.customWarpGw(arweave, defaultWarpGwOptions, cacheOptions, 'seqtestnet').useGwUrl(WARP_GW_TESTNET_URL); + return this.customWarpGw(arweave, defaultWarpGwOptions, cacheOptions, 'testnet').useGwUrl(WARP_GW_TESTNET_URL); } } diff --git a/src/core/modules/impl/ArweaveGatewayBundledContractDefinitionLoader.ts b/src/core/modules/impl/ArweaveGatewayBundledContractDefinitionLoader.ts index ee88d412..de9200c1 100644 --- a/src/core/modules/impl/ArweaveGatewayBundledContractDefinitionLoader.ts +++ b/src/core/modules/impl/ArweaveGatewayBundledContractDefinitionLoader.ts @@ -40,14 +40,6 @@ export class ArweaveGatewayBundledContractDefinitionLoader implements Definition const contractSrcTxId = evolvedSrcTxId ? evolvedSrcTxId : getTagValue(contractTx.tags, SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID); - const testnet = getTagValue(contractTx.tags, WARP_TAGS.WARP_TESTNET) || null; - - if (testnet && this.env !== 'testnet') { - throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.'); - } - if (!testnet && this.env === 'testnet') { - throw new Error('Trying to use non-testnet contract in a testnet env.'); - } const minFee = getTagValue(contractTx.tags, SMART_WEAVE_TAGS.MIN_FEE); const manifest = getTagValue(contractTx.tags, WARP_TAGS.MANIFEST) @@ -77,8 +69,7 @@ export class ArweaveGatewayBundledContractDefinitionLoader implements Definition metadata, manifest, contractTx: await this.convertToWarpCompatibleContractTx(contractTx), - srcTx: await this.convertToWarpCompatibleContractTx(srcTx), - testnet + srcTx: await this.convertToWarpCompatibleContractTx(srcTx) }; this.logger.info(`Contract definition loaded in: ${benchmark.elapsed()}`); diff --git a/src/core/modules/impl/ContractDefinitionLoader.ts b/src/core/modules/impl/ContractDefinitionLoader.ts index ea78e8dc..bffda741 100644 --- a/src/core/modules/impl/ContractDefinitionLoader.ts +++ b/src/core/modules/impl/ContractDefinitionLoader.ts @@ -48,13 +48,6 @@ export class ContractDefinitionLoader implements DefinitionLoader { const contractSrcTxId = forcedSrcTxId ? forcedSrcTxId : this.tagsParser.getTag(contractTx, SMART_WEAVE_TAGS.CONTRACT_SRC_TX_ID); - const testnet = this.tagsParser.getTag(contractTx, WARP_TAGS.WARP_TESTNET) || null; - if (testnet && this.env !== 'testnet') { - throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.'); - } - if (!testnet && this.env === 'testnet') { - throw new Error('Trying to use non-testnet contract in a testnet env.'); - } const minFee = this.tagsParser.getTag(contractTx, SMART_WEAVE_TAGS.MIN_FEE); let manifest = null; const rawManifest = this.tagsParser.getTag(contractTx, WARP_TAGS.MANIFEST); @@ -86,8 +79,7 @@ export class ContractDefinitionLoader implements DefinitionLoader { metadata, manifest, contractTx: contractTx.toJSON(), - srcTx, - testnet + srcTx }; } diff --git a/src/core/modules/impl/WarpGatewayContractDefinitionLoader.ts b/src/core/modules/impl/WarpGatewayContractDefinitionLoader.ts index 40c5dc13..25f7eb63 100644 --- a/src/core/modules/impl/WarpGatewayContractDefinitionLoader.ts +++ b/src/core/modules/impl/WarpGatewayContractDefinitionLoader.ts @@ -51,13 +51,11 @@ export class WarpGatewayContractDefinitionLoader implements DefinitionLoader { // eslint-disable-next-line @typescript-eslint/no-explicit-any result.srcBinary = Buffer.from((result.srcBinary as any).data); } - this.verifyEnv(result); return result; } const benchmark = Benchmark.measure(); const contract = await this.doLoad(contractTxId, evolvedSrcTxId); this.rLogger.info(`Contract definition loaded in: ${benchmark.elapsed()}`); - this.verifyEnv(contract); await this.putToCache(contractTxId, contract, evolvedSrcTxId); @@ -119,15 +117,6 @@ export class WarpGatewayContractDefinitionLoader implements DefinitionLoader { return this.srcCache; } - private verifyEnv(def: ContractDefinition): void { - if (def.testnet && this.env !== 'testnet') { - throw new Error('Trying to use testnet contract in a non-testnet env. Use the "forTestnet" factory method.'); - } - if (!def.testnet && this.env === 'testnet') { - throw new Error('Trying to use non-testnet contract in a testnet env.'); - } - } - // Gets ContractDefinition and ContractSource from two caches and returns a combined structure private async getFromCache(contractTxId: string, srcTxId?: string): Promise | null> { const contract = (await this.definitionCache.get(new CacheKey(contractTxId, 'cd'))) as SortKeyCacheResult< diff --git a/src/legacy/create-interaction-tx.ts b/src/legacy/create-interaction-tx.ts index 523c25fd..06e0bb4a 100644 --- a/src/legacy/create-interaction-tx.ts +++ b/src/legacy/create-interaction-tx.ts @@ -1,5 +1,5 @@ import Arweave from 'arweave'; -import { SMART_WEAVE_TAGS, WARP_TAGS } from '../core/KnownTags'; +import { SMART_WEAVE_TAGS } from '../core/KnownTags'; import { GQLNodeInterface } from './gqlResult'; import { TagsParser } from '../core/modules/impl/TagsParser'; import { SigningFunction } from '../contract/Signature'; @@ -15,7 +15,6 @@ export async function createInteractionTx( target = '', winstonQty = '0', dummy = false, - isTestnet: boolean, reward?: string ): Promise { const options: Partial = { @@ -43,7 +42,7 @@ export async function createInteractionTx( const interactionTx = await arweave.createTransaction(options); - const interactionTags = createInteractionTagsList(contractId, input, isTestnet, tags); + const interactionTags = createInteractionTagsList(contractId, input, tags); interactionTags.forEach((t) => interactionTx.addTag(t.name, t.value)); if (signer) { @@ -100,12 +99,7 @@ export function createDummyTx(tx: Transaction, from: string, block: BlockData): }; } -export function createInteractionTagsList( - contractId: string, - input: Input, - isTestnet: boolean, - customTags?: Tags -) { +export function createInteractionTagsList(contractId: string, input: Input, customTags?: Tags) { const interactionTags: Tags = []; if (customTags && customTags.length) { @@ -120,9 +114,6 @@ export function createInteractionTagsList( interactionTags.push(new Tag(SMART_WEAVE_TAGS.SDK, 'Warp')); interactionTags.push(new Tag(SMART_WEAVE_TAGS.CONTRACT_TX_ID, contractId)); interactionTags.push(new Tag(SMART_WEAVE_TAGS.INPUT, JSON.stringify(input))); - if (isTestnet) { - interactionTags.push(new Tag(WARP_TAGS.WARP_TESTNET, '1.0.0')); - } return interactionTags; }