Skip to content

Commit eeef360

Browse files
committed
fix: rebase to master and fix wallet incompatibilities
1 parent 5f0b8ab commit eeef360

File tree

6 files changed

+16
-27
lines changed

6 files changed

+16
-27
lines changed

‎cli/lib/nf3.mjs

+8-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Web3 from 'web3';
33
import WebSocket from 'ws';
44
import EventEmitter from 'events';
55
import { Mutex } from 'async-mutex';
6-
import config from 'config';
76
import { approve } from './tokens.mjs';
87
import erc20 from './abis/ERC20.mjs';
98
import erc721 from './abis/ERC721.mjs';
@@ -164,13 +163,19 @@ class Nf3 {
164163
await this.nonceMutex.runExclusive(async () => {
165164
// if we don't have a nonce, we must get one from the ethereum client
166165
if (!this.nonce) this.nonce = await this.web3.eth.getTransactionCount(this.ethereumAddress);
166+
167+
let gasPrice = 10000000000;
168+
const gas = (await this.web3.eth.getBlock('latest')).gasLimit;
169+
const blockGasPrice = Number(await this.web3.eth.getGasPrice());
170+
if (blockGasPrice > gasPrice) gasPrice = blockGasPrice;
171+
167172
tx = {
168173
from: this.ethereumAddress,
169174
to: contractAddress,
170175
data: unsignedTransaction,
171176
value: fee,
172-
gas: config.WEB3_OPTIONS.gas,
173-
gasPrice: config.WEB3_OPTIONS.gasPrice,
177+
gas,
178+
gasPrice,
174179
nonce: this.nonce,
175180
};
176181
this.nonce++;

‎cli/package-lock.json

+1-8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on .

‎cli/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"clear": "^0.1.0",
1616
"cli-table": "^0.3.6",
1717
"commander": "^8.2.0",
18-
"config": "^3.3.6",
1918
"figlet": "^1.5.2",
2019
"inquirer": "^8.1.4",
2120
"web3": "^1.5.2",

‎config/default.js

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
const Web3 = require('web3');
2-
3-
const web3 = new Web3();
4-
51
module.exports = {
62
COMMITMENTS_DB: 'nightfall_commitments',
73
OPTIMIST_DB: 'optimist_data',
@@ -34,9 +30,7 @@ module.exports = {
3430
`ws://${process.env.BLOCKCHAIN_WS_HOST}:${process.env.BLOCKCHAIN_PORT}`,
3531
USE_INFURA: process.env.USE_INFURA === 'true',
3632
ETH_PRIVATE_KEY: process.env.ETH_PRIVATE_KEY, // owner's/deployer's private key
37-
ETH_ADDRESS: process.env.ETH_PRIVATE_KEY
38-
? web3.eth.accounts.privateKeyToAccount(process.env.ETH_PRIVATE_KEY, false).address
39-
: undefined, // owner's address
33+
ETH_ADDRESS: process.env.ETH_ADDRESS,
4034
OPTIMIST_HOST: process.env.OPTIMIST_HOST || 'optimist',
4135
OPTIMIST_PORT: process.env.OPTIMIST_PORT || 80,
4236
clientBaseUrl: `http://${process.env.CLIENT_HOST}:${process.env.CLIENT_PORT}`,
@@ -46,9 +40,7 @@ module.exports = {
4640
userEthereumSigningKey:
4741
process.env.USER_ETHEREUM_SIGNING_KEY ||
4842
'0x4775af73d6dc84a0ae76f8726bda4b9ecf187c377229cb39e1afa7a18236a69e',
49-
userAddress: process.env.USER_ETHEREUM_SIGNING_KEY
50-
? web3.eth.accounts.privateKeyToAccount(process.env.USER_ETHEREUM_SIGNING_KEY, false).address
51-
: undefined, // user's address
43+
userAddress: process.env.USER_ADDRESS,
5244
zkpMnemonic:
5345
process.env.ZKP_MNEMONIC ||
5446
'hurt labor ketchup seven scan swap dirt brown brush path goat together',
@@ -58,10 +50,7 @@ module.exports = {
5850
WEB3_OPTIONS: {
5951
gas: process.env.GAS || 8000000,
6052
gasPrice: process.env.GAS_PRICE || '20000000000',
61-
from:
62-
process.env.FROM_ADDRESS || process.env.ETH_PRIVATE_KEY
63-
? web3.eth.accounts.privateKeyToAccount(process.env.ETH_PRIVATE_KEY, false).address
64-
: undefined,
53+
from: process.env.FROM_ADDRESS || process.env.ETH_ADDRESS,
6554
},
6655
WEB3_PROVIDER_OPTIONS: {
6756
clientConfig: {

‎test/ping-pong/docker-compose.ropsten.yml

+4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,13 @@ services:
1717
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
1818
BLOCKCHAIN_PORT: 80
1919
ETH_PRIVATE_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
20+
# this should be the address corresponding to the above provate key
21+
ETH_ADDRESS: db080dC48961bC1D67a0A4151572eCb824cC76E8
2022
USE_ROPSTEN: enable
2123
GAS_PRICE: 20000000000
2224
# This is only needed for test purposes - it gives tokens to the user at startup
2325
USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
26+
USER_ADDRESS: db080dC48961bC1D67a0A4151572eCb824cC76E8
2427

2528
optimist:
2629
environment:
@@ -39,3 +42,4 @@ services:
3942
BLOCKCHAIN_WS_HOST: ropsten1-ws.testnet.nightfall3.com
4043
BLOCKCHAIN_PORT: 80
4144
USER_ETHEREUM_SIGNING_KEY: abf4ed9f30bd1e4a290310d726c7bbdf39cd75a25eebd9a3a4874e10b4a0c4ce
45+
USER_ADDRESS: db080dC48961bC1D67a0A4151572eCb824cC76E8

‎wallet/package-lock.json

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on .

0 commit comments

Comments
 (0)