Skip to content

Commit

Permalink
Multiple fixes (#1785)
Browse files Browse the repository at this point in the history
* add sepolia logic

* update min gas fee value

* Release 3.1.5-next.0

* update graphqlAsset url

* update timeouts

* added logs

* update timeouts

* upgrade node version

* cleanups
  • Loading branch information
bogdanfazakas committed May 9, 2024
1 parent be52ec2 commit 6a6f450
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand All @@ -37,7 +37,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
- name: Cache node_modules
uses: actions/cache@v2
env:
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['15', '16']
node: ['20', '18']

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -199,7 +199,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'

- name: checkout ocean.js repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '20'
registry-url: https://registry.npmjs.org/
- run: npm ci

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
16
20
13 changes: 12 additions & 1 deletion src/utils/ContractUtils.ts
@@ -1,11 +1,13 @@
import { ethers, Signer, providers, Contract, ContractFunction, BigNumber } from 'ethers'

import { Config } from '../config'
import { minAbi } from '.'
import { LoggerInstance, minAbi } from '.'

const MIN_GAS_FEE_POLYGON = 30000000000 // minimum recommended 30 gwei polygon main and mumbai fees
const MIN_GAS_FEE_SEPOLIA = 4000000000 // minimum 4 gwei for eth sepolia testnet
const POLYGON_NETWORK_ID = 137
const MUMBAI_NETWORK_ID = 80001
const SEPOLIA_NETWORK_ID = 11155111

export function setContractDefaults(contract: Contract, config: Config): Contract {
// TO DO - since ethers does not provide this
Expand Down Expand Up @@ -134,11 +136,18 @@ export async function sendTx(
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePriorityFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePriorityFeePerGas),

maxFeePerGas:
(chainId === MUMBAI_NETWORK_ID || chainId === POLYGON_NETWORK_ID) &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_POLYGON
? MIN_GAS_FEE_POLYGON
: chainId === SEPOLIA_NETWORK_ID &&
Number(aggressiveFeePerGas) < MIN_GAS_FEE_SEPOLIA
? MIN_GAS_FEE_SEPOLIA
: Number(aggressiveFeePerGas)
}
} else {
Expand All @@ -149,8 +158,10 @@ export async function sendTx(
overrides.gasLimit = estGas.add(20000)
try {
const trxReceipt = await functionToSend(...args, overrides)
await trxReceipt.wait()
return trxReceipt
} catch (e) {
LoggerInstance.error('Send tx error: ', e)
return null
}
}
4 changes: 2 additions & 2 deletions test/integration/PublishEditConsume.test.ts
Expand Up @@ -95,7 +95,7 @@ const grapqlFile: Files = {
files: [
{
type: 'graphql',
url: 'https://v4.subgraph.goerli.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
url: 'https://v4.subgraph.sepolia.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
query: `"
query{
nfts(orderBy: createdTimestamp,orderDirection:desc){
Expand Down Expand Up @@ -392,7 +392,7 @@ describe('Publish consume test', async () => {
providerUrl
)
assert(grapqlOrderTx, 'Ordering graphql dataset failed.')
})
}).timeout(40000)

it('Should download the datasets files', async () => {
const urlDownloadUrl = await ProviderInstance.getDownloadUrl(
Expand Down
6 changes: 3 additions & 3 deletions test/integration/PublishFlows.test.ts
Expand Up @@ -196,12 +196,12 @@ describe('Publish tests', async () => {
)
})

delay(10000)
delay(19000)

it('should resolve the fixed price dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(fixedPricedDID)
assert(resolvedDDO, 'Cannot fetch DDO from Aquarius')
})
}).timeout(40000)

it('should publish a dataset with dispenser (create NFT + Datatoken + dispenser) with no defined MetadataProof', async () => {
const dispenserDdo: DDO = { ...genericAsset }
Expand Down Expand Up @@ -289,7 +289,7 @@ describe('Publish tests', async () => {
)
})

delay(10000)
delay(19000)

it('should resolve the free dataset', async () => {
const resolvedDDO = await aquarius.waitForAqua(dispenserDID)
Expand Down

0 comments on commit 6a6f450

Please sign in to comment.