Skip to content

Commit

Permalink
refactor: pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
franciscotobar committed Feb 16, 2024
1 parent 5d9f414 commit 13da238
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 254 deletions.
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions scripts/GasEstimation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ async function deployAndSetup(payment: Payment = 'erc20') {

const factory = await createSmartWalletFactory(
template,
supportedTypes[payment],
owner
owner,
supportedTypes[payment]
);

const tokenContracts: Record<Payment, string> = {
Expand Down
24 changes: 11 additions & 13 deletions test/RelayHub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,9 @@ describe('RelayHub', function () {
value: ethers.utils.parseEther('1'),
});

factory = await createSmartWalletFactory(
smartWalletTemplate,
'Default',
owner
);
factory = await createSmartWalletFactory(smartWalletTemplate, owner);
});

describe('#add/disable relay workers', function () {
const expectRelayWorkersAddedEvent = (
relayWorkersAddedEvent?: RelayWorkersAddedEvent
Expand Down Expand Up @@ -994,8 +991,8 @@ describe('RelayHub', function () {
);
boltzFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Boltz',
owner
owner,
'Boltz'
);
swap = await deployContract<TestSwap>('TestSwap');
await fundedAccount.sendTransaction({
Expand Down Expand Up @@ -1210,8 +1207,8 @@ describe('RelayHub', function () {
);
minimalBoltzFactory = await createSmartWalletFactory(
smartWalletTemplate,
'MinimalBoltz',
owner
owner,
'MinimalBoltz'
);
swap = await deployContract<TestSwap>('TestSwap');
await fundedAccount.sendTransaction({
Expand Down Expand Up @@ -1322,7 +1319,10 @@ describe('RelayHub', function () {
await expect(deployCall).not.to.be.rejected;
});

it.skip('should fail if not enough gas to pay for native transfer', async function () {
// When the tokenGas is set to 0, we should expect to fail but the VM provide a minimum gas of 2300 by default
// that covers the transfer cost, this will only fail if the destination, its a contract that consumes more than
// this amount https://ethereum.stackexchange.com/questions/70208/gas-is-0-when-executing-call-opcode
it('should fail if not enough gas to pay for native transfer', async function () {
const deployRequest = cloneDeployRequest({
request: {
index: nextWalletIndex.toString(),
Expand All @@ -1347,9 +1347,7 @@ describe('RelayHub', function () {
.connect(relayWorker)
.deployCall(deployRequest, signature, { gasLimit });

await expect(deployCall).to.be.rejectedWith(
'Unable to pay for deployment'
);
await expect(deployCall).not.to.be.rejected;
});
});

Expand Down
10 changes: 3 additions & 7 deletions test/relayclient/RelayClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ describe('RelayClient', function () {
);
smartWalletFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Default',
fundedAccount
);
});
Expand Down Expand Up @@ -562,7 +561,7 @@ describe('RelayClient', function () {
expect(to).to.be.equal(relayHub.address);
});

describe('with contract execution during deploy', function () {
describe('with contract execution', function () {
let data: string;
let swap: TestSwap;
let boltzFactory: BoltzSmartWalletFactory;
Expand All @@ -574,8 +573,8 @@ describe('RelayClient', function () {
);
boltzFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Boltz',
fundedAccount
fundedAccount,
'Boltz'
);
data = swap.interface.encodeFunctionData('claim', [
constants.HashZero,
Expand Down Expand Up @@ -648,7 +647,6 @@ describe('RelayClient', function () {
);
const smartWalletFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Default',
fundedAccount
);
smartWallet = await createSupportedSmartWallet({
Expand Down Expand Up @@ -734,7 +732,6 @@ describe('RelayClient', function () {
);
const smartWalletFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Default',
fundedAccount
);
smartWallet = await createSupportedSmartWallet({
Expand Down Expand Up @@ -779,7 +776,6 @@ describe('RelayClient', function () {
);
const smartWalletFactory = await createSmartWalletFactory(
smartWalletTemplate,
'Default',
fundedAccount
);
const mockServer = express();
Expand Down
Loading

0 comments on commit 13da238

Please sign in to comment.