Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
Deploy vector-0.2.0-beta.8
Browse files Browse the repository at this point in the history
  • Loading branch information
rhlsthrm committed Mar 9, 2021
2 parents 8c330b3 + 5ae49b8 commit 2cd089f
Show file tree
Hide file tree
Showing 47 changed files with 230 additions and 402 deletions.
4 changes: 2 additions & 2 deletions modules/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"test": "ts-mocha --check-leaks --exit --timeout 60000 'src/**/*.spec.ts'"
},
"dependencies": {
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@sinclair/typebox": "0.12.7",
"crypto": "1.0.1",
"fastify": "3.13.0",
Expand Down
10 changes: 5 additions & 5 deletions modules/browser-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@connext/vector-browser-node",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"author": "",
"license": "ISC",
"description": "",
Expand All @@ -17,10 +17,10 @@
"test": "ts-mocha --bail --check-leaks --exit --timeout 60000 'src/**/*.spec.ts'"
},
"dependencies": {
"@connext/vector-contracts": "0.2.0-beta.7",
"@connext/vector-engine": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-contracts": "0.2.0-beta.8",
"@connext/vector-engine": "0.2.0-beta.8",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@ethersproject/address": "5.0.10",
"@ethersproject/bignumber": "5.0.14",
"@ethersproject/constants": "5.0.9",
Expand Down
4 changes: 2 additions & 2 deletions modules/browser-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class BrowserNode implements INodeService {
config.logger = pino({ name: config.signer.publicIdentifier });
}
const node = new BrowserNode({ logger: config.logger, chainProviders: config.chainProviders });
// TODO: validate schema
// TODO: validate schema GH issue #429
config.logger.info(
{ method: "connect", publicIdentifier: config.signer.publicIdentifier, signerAddress: config.signer.address },
"Connecting with provided signer",
Expand Down Expand Up @@ -148,7 +148,7 @@ export class BrowserNode implements INodeService {

// method for non-signer based apps to connect to iframe
async init(params: { signature?: string; signer?: string } = {}): Promise<void> {
// TODO: validate config
// TODO: validate config GH issue #429
const method = "init";
this.logger.debug({ method }, "Method started");
const iframeSrc = this.iframeSrc ?? "https://wallet.connext.network";
Expand Down
2 changes: 1 addition & 1 deletion modules/browser-node/src/services/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export class BrowserStore implements IEngineStore, IChainServiceStore {
await this.db.transaction("rw", this.db.channels, this.db.transfers, async () => {
// remove all "active" transfers
const currActive = await this.getActiveTransfers(channelState.channelAddress);
// TODO: can we "unassociate" them without deleting them?
// TODO: can we "unassociate" them without deleting them? GH #431
await this.db.transfers.bulkDelete(currActive.map((t) => t.transferId));
// save channel
await this.db.channels.put(channelState);
Expand Down
6 changes: 3 additions & 3 deletions modules/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@connext/vector-contracts",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"license": "ISC",
"description": "Smart contracts powering Connext's minimalist channel platform",
"keywords": [
Expand Down Expand Up @@ -28,8 +28,8 @@
},
"dependencies": {
"@connext/pure-evm-wasm": "0.1.4",
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@ethersproject/abi": "5.0.12",
"@ethersproject/abstract-provider": "5.0.9",
"@ethersproject/abstract-signer": "5.0.13",
Expand Down
1 change: 0 additions & 1 deletion modules/contracts/src.ts/commitments/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ export class WithdrawCommitment {
return { to: this.channelAddress, value: 0, data: data };
}

// TODO: include commitment type
public async addSignatures(signature1?: string, signature2?: string): Promise<void> {
const hash = this.hashToSign();
for (const sig of [signature1, signature2]) {
Expand Down
2 changes: 1 addition & 1 deletion modules/contracts/src.ts/services/ethReader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getContract, createChannel } from "../utils";

import { EthereumChainReader } from "./ethReader";

// TODO: check whether result is valid, not just whether it exists
// TODO: check whether result is valid, not just whether it exists #432
describe("EthereumChainReader", function () {
this.timeout(120_000);
const assetId = AddressZero;
Expand Down
9 changes: 2 additions & 7 deletions modules/contracts/src.ts/services/ethService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,6 @@ export class EthereumChainService extends EthereumChainReader implements IVector
return Result.fail(new ChainError(ChainError.reasons.ResolverNeeded));
}

// TODO: should this be checked? is there some other option?
if (transferState.balance.amount[1] !== "0") {
return Result.fail(new ChainError(ChainError.reasons.NotInitialState));
}

const encodedState = encodeTransferState(transferState.transferState, transferState.transferEncodings[0]);
const encodedResolver = encodeTransferResolver(transferState.transferResolver, transferState.transferEncodings[1]);

Expand Down Expand Up @@ -632,7 +627,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector
reason: TransactionReason,
txFn: () => Promise<undefined | TransactionResponse>,
): Promise<Result<TransactionResponse | undefined, ChainError>> {
// TODO: add retries on specific errors
// TODO: add retries on specific errors #347
try {
const response = await this.queue.add(async () => {
const response = await txFn();
Expand All @@ -653,7 +648,7 @@ export class EthereumChainService extends EthereumChainReader implements IVector
});
// Register callbacks for saving tx, then return
response
.wait() // TODO: confirmation blocks?
.wait() // TODO: confirmation blocks? #434
.then((receipt) => {
if (receipt.status === 0) {
this.log.error({ method: "sendTxAndParseResponse", receipt }, "Transaction reverted");
Expand Down
14 changes: 3 additions & 11 deletions modules/contracts/src.ts/tests/cmcs/adjudicator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ import { advanceBlocktime, createChannel, getContract } from "../../utils";
const getOnchainBalance = async (assetId: string, address: string): Promise<BigNumber> => {
return assetId === AddressZero
? provider.getBalance(address)
: new Contract(
assetId,
(await deployments.getArtifact("TestToken")).abi,
provider,
).balanceOf(address);
: new Contract(assetId, (await deployments.getArtifact("TestToken")).abi, provider).balanceOf(address);
};
describe("CMCAdjudicator.sol", async function () {
this.timeout(120_000);
Expand Down Expand Up @@ -246,11 +242,7 @@ describe("CMCAdjudicator.sol", async function () {
describe("disputeChannel", () => {
it("should fail if state.alice is incorrect", async function () {
await expect(
channel.disputeChannel(
{ ...channelState, alice: getRandomAddress() },
aliceSignature,
bobSignature,
),
channel.disputeChannel({ ...channelState, alice: getRandomAddress() }, aliceSignature, bobSignature),
).revertedWith("CMCAdjudicator: INVALID_CHANNEL");
});

Expand Down Expand Up @@ -715,7 +707,7 @@ describe("CMCAdjudicator.sol", async function () {
).revertedWith("CMCAdjudicator: INVALID_TRANSFER_HASH");
});

// TODO: need to write a transfer def for this
// TODO: need to write a transfer def for this #435
// it.skip("should fail if the resolved balances are > initial balances", async () => {});

it("should correctly resolve + defund transfer if transfer is still in dispute (cancelling resolve)", async function () {
Expand Down
4 changes: 4 additions & 0 deletions modules/documentation/docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Next Release

## 0.2.0-beta.8

- \[engine, router\] Allow users to specify if they want to receive an exact amount when requesting a quote

## 0.2.0-beta.7

- [engine] Fix transfer event balances
Expand Down
10 changes: 5 additions & 5 deletions modules/engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@connext/vector-engine",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"description": "",
"author": "Arjun Bhuptani",
"license": "MIT",
Expand All @@ -14,10 +14,10 @@
"test": "nyc ts-mocha --check-leaks --exit --timeout 60000 'src/**/*.spec.ts'"
},
"dependencies": {
"@connext/vector-contracts": "0.2.0-beta.7",
"@connext/vector-protocol": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-contracts": "0.2.0-beta.8",
"@connext/vector-protocol": "0.2.0-beta.8",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@ethersproject/address": "5.0.10",
"@ethersproject/bignumber": "5.0.14",
"@ethersproject/bytes": "5.0.10",
Expand Down
6 changes: 0 additions & 6 deletions modules/engine/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,6 @@ export class VectorEngine implements IVectorEngine {
return this.vector.signerAddress;
}

// TODO: create injected validation that handles submitting transactions
// IFF there was a fee involved. Should:
// - check if fee > 0
// - yes && my withdrawal: make sure transaction hash is included in
// the meta (verify tx)

private async setupListener(gasSubsidyPercentage: number): Promise<void> {
await setupEngineListeners(
this.evts,
Expand Down
14 changes: 4 additions & 10 deletions modules/engine/src/listeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,16 @@ export async function getWithdrawalQuote(
chainService: IVectorChainService,
logger: BaseLogger,
): Promise<Result<WithdrawalQuote, WithdrawQuoteError>> {
const receiveExactAmount = request.receiveExactAmount ?? false;
// Helper to sign the quote + return to user
const createAndSignQuote = async (_fee: BigNumber): Promise<Result<WithdrawalQuote, WithdrawQuoteError>> => {
const withdrawalAmount = receiveExactAmount ? BigNumber.from(request.amount).add(_fee) : request.amount;
const quote = {
channelAddress: request.channelAddress,
amount: _fee.gt(request.amount) ? "0" : BigNumber.from(request.amount).sub(_fee).toString(), // hash of negative value fails
amount: _fee.gt(withdrawalAmount) ? "0" : BigNumber.from(withdrawalAmount).sub(_fee).toString(), // hash of negative value fails
assetId: request.assetId,
fee: _fee.toString(),
expiry: (Date.now() + DEFAULT_FEE_EXPIRY).toString(), // TODO: make this configurable
expiry: (Date.now() + DEFAULT_FEE_EXPIRY).toString(), // TODO: make this configurable #436
};
try {
const signature = await signer.signMessage(hashWithdrawalQuote(quote));
Expand Down Expand Up @@ -717,8 +719,6 @@ async function handleConditionalTransferCreation(
logger.warn({ transferId, routingId, meta: transfer.meta }, "Cannot route transfer");
return;
}

// TODO: add automatic resolution for given transfer types
}

async function handleConditionalTransferResolution(
Expand Down Expand Up @@ -1146,8 +1146,6 @@ export const resolveWithdrawal = async (
logger.info({ quote, method, methodId }, "Withdrawal fees verified");
}

// TODO: should inject validation to make sure that a withdrawal transfer
// is properly signed before its been merged into your channel
const commitment = new WithdrawCommitment(
channelAddress,
alice,
Expand All @@ -1168,10 +1166,6 @@ export const resolveWithdrawal = async (
// Alice may or may not charge a fee for this service, and both parties
// are welcome to submit the commitment if the other party does not.

// TODO: if bob is the withdrawal creator and alice has charged a fee
// for submitting the withdrawal, bob will refuse to sign the resolve
// update until the transaction is properly submitted onchain (enforced
// via injected validation)
let transactionHash: string | undefined = undefined;
if (signer.address === alice && !initiatorSubmits) {
// Submit withdrawal to chain
Expand Down
4 changes: 2 additions & 2 deletions modules/engine/src/paramConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export async function convertConditionalTransferParams(
// TODO: transfers should be allowed to go to participants outside of the
// channel (i.e. some dispute recovery address). This should be passed in
// via the transfer params as a `recoveryAddress` variable
// const transferStateRecipient = recipient ? getSignerAddressFromPublicIdentifier(recipient) : channelCounterparty;
// const transferStateRecipient = recipient ? getSignerAddressFromPublicIdentifier(recipient) : channelCounterparty; #437

// Get the transfer information from the chain reader
const registryRes = !type.startsWith(`0x`)
Expand Down Expand Up @@ -219,7 +219,7 @@ export async function convertWithdrawParams(
const initiatorSubmits = params.initiatorSubmits ?? false;

// TODO: refactor to always determine who submits based on the
// `initiatorSubmits` flag.
// `initiatorSubmits` flag. #428
if (initiatorSubmits && signer.address === channel.alice) {
return Result.fail(
new ParameterConversionError(
Expand Down
2 changes: 1 addition & 1 deletion modules/engine/src/testing/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("VectorEngine", () => {

// TODO: all methods should have tests that ensure every failure can be hit
// below outlines only the most important (i.e. functions with the most
// complex logic within the index file of the module)
// complex logic within the index file of the module) #427

// NOTE: these are nice-to-haves

Expand Down
2 changes: 0 additions & 2 deletions modules/engine/src/testing/listeners.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ describe(testName, () => {
// Withdraw responder is alice, and she tried to submit tx
const [channelState, minTx] = chainService.sendWithdrawTx.args[0];
expect(channelState).to.be.deep.eq(updatedChannelState);
// TODO: stronger transaction assertions?
expect(minTx).to.be.ok;
}

Expand Down Expand Up @@ -481,7 +480,6 @@ describe(testName, () => {
if (chainService.sendWithdrawTx.callCount) {
const [channelState, minTx] = chainService.sendWithdrawTx.args[0];
expect(channelState).to.be.deep.eq(updatedChannelState);
// TODO: stronger transaction assertions?
expect(minTx).to.be.ok;
}
};
Expand Down
6 changes: 3 additions & 3 deletions modules/iframe-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"version": "0.0.1",
"private": true,
"dependencies": {
"@connext/vector-browser-node": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-browser-node": "0.2.0-beta.8",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@ethersproject/bytes": "5.0.10",
"@ethersproject/hdnode": "5.0.9",
"@ethersproject/keccak256": "5.0.8",
Expand Down
8 changes: 4 additions & 4 deletions modules/protocol/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@connext/vector-protocol",
"version": "0.2.0-beta.7",
"version": "0.2.0-beta.8",
"description": "",
"main": "dist/vector.js",
"types": "dist/vector.d.ts",
Expand All @@ -14,9 +14,9 @@
"author": "Arjun Bhuptani",
"license": "MIT",
"dependencies": {
"@connext/vector-contracts": "0.2.0-beta.7",
"@connext/vector-types": "0.2.0-beta.7",
"@connext/vector-utils": "0.2.0-beta.7",
"@connext/vector-contracts": "0.2.0-beta.8",
"@connext/vector-types": "0.2.0-beta.8",
"@connext/vector-utils": "0.2.0-beta.8",
"@ethersproject/abi": "5.0.12",
"@ethersproject/bignumber": "5.0.14",
"@ethersproject/constants": "5.0.9",
Expand Down
2 changes: 1 addition & 1 deletion modules/protocol/src/testing/validate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ describe("validateUpdateParams", () => {
});
});

// TODO: validUpdateParamsStub is not working
// TODO: validUpdateParamsStub is not working #441
describe.skip("validateParamsAndApplyUpdate", () => {
// Test values
const signer = getRandomChannelSigner();
Expand Down
6 changes: 3 additions & 3 deletions modules/protocol/src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function validateUpdateParams<T extends UpdateType = any>(
return handleError(ValidationError.reasons.ChannelNotFound);
}

// TODO: add in resuming from dispute
// TODO: add in resuming from dispute #438
if (previousState?.inDispute ?? false) {
return handleError(ValidationError.reasons.InDispute);
}
Expand Down Expand Up @@ -111,7 +111,7 @@ export async function validateUpdateParams<T extends UpdateType = any>(
return handleError(ValidationError.reasons.InvalidChannelAddress);
}

// TODO: should we validate the transfer registry somehow? (i.e. fetching transfers)
// TODO: should we validate the transfer registry somehow? (i.e. fetching transfers) #439

// Make sure the timeout is valid:
// - should be above min (24hrs)
Expand All @@ -131,7 +131,7 @@ export async function validateUpdateParams<T extends UpdateType = any>(
}

// TODO: ideally should only allow one channel per participant/chain set,
// but currently there is no store-service passed into this function
// but currently there is no store-service passed into this function #439
break;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/protocol/src/vector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export class Vector implements IVectorProtocol {
);

// sync latest state before starting
// TODO: skipping this, if it works, consider just not awaiting the promise so the rest of startup can continue
// TODO: skipping this, if it works, consider just not awaiting the promise so the rest of startup can continue #440
if (!this.skipCheckIn) {
const channels = await this.storeService.getChannelStates();
const providers = this.chainReader.getChainProviders();
Expand All @@ -286,7 +286,7 @@ export class Vector implements IVectorProtocol {
// First check on current dispute status of all channels onchain
// Since we have no way of knowing the last time the protocol
// connected, we must check this on startup
// TODO: is there a better way to do this?
// TODO: is there a better way to do this? #440
await Promise.all(
channels.map(async (channel) => {
if (!supportedChains.includes(channel.networkContext.chainId)) {
Expand All @@ -313,7 +313,7 @@ export class Vector implements IVectorProtocol {
}
try {
// save dispute record
// TODO: implement recovery from dispute
// TODO: implement recovery from dispute #438
await this.storeService.saveChannelDispute({ ...channel, inDispute: true }, dispute);
} catch (e) {
this.logger.error(
Expand Down
Loading

0 comments on commit 2cd089f

Please sign in to comment.