-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1977 from aeternity/feature/update-compiler
Update cli compiler to 8.0.0
- Loading branch information
Showing
8 changed files
with
23 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,10 +16,7 @@ export async function getCachedIncreasedGasPrice(node: Node): Promise<bigint> { | |
|
||
// TODO: remove after requiring [email protected] | ||
const { nodeVersion } = await node._getCachedStatus(); | ||
// TODO: remove remove '6.12.0+' check after releasing 6.13.0 | ||
if (!nodeVersion.startsWith('6.12.0+') && !semverSatisfies(nodeVersion, '6.13.0', '8.0.0')) { | ||
return 0n; | ||
} | ||
if (!semverSatisfies(nodeVersion, '6.13.0')) return 0n; | ||
|
||
const { minGasPrice, utilization } = (await node.getRecentGasPrices())[0]; | ||
let gasPrice = utilization < 70 ? 0n : BigInt( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
export default function semverSatisfies( | ||
version: string, | ||
geVersion: string, | ||
ltVersion: string, | ||
): boolean { | ||
function verCmp(a: string, b: string): number { | ||
const getComponents = (v: string): number[] => v | ||
.split(/[-+]/)[0].split('.').map((i) => +i); | ||
|
||
const versionComponents = getComponents(version); | ||
const geComponents = getComponents(geVersion); | ||
const ltComponents = getComponents(ltVersion); | ||
const aComponents = getComponents(a); | ||
const bComponents = getComponents(b); | ||
|
||
const base = Math.max(...versionComponents, ...geComponents, ...ltComponents) + 1; | ||
const base = Math.max(...aComponents, ...bComponents) + 1; | ||
const componentsToNumber = (components: number[]): number => components.reverse() | ||
.reduce((acc, n, idx) => acc + n * base ** idx, 0); | ||
|
||
const vNumber = componentsToNumber(versionComponents); | ||
const geNumber = componentsToNumber(geComponents); | ||
const ltNumber = componentsToNumber(ltComponents); | ||
return vNumber >= geNumber && vNumber < ltNumber; | ||
return componentsToNumber(aComponents) - componentsToNumber(bComponents); | ||
} | ||
|
||
export default function semverSatisfies( | ||
version: string, | ||
geVersion: string, | ||
ltVersion?: string, | ||
): boolean { | ||
return verCmp(version, geVersion) >= 0 | ||
&& (ltVersion == null || verCmp(version, ltVersion) < 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters