Skip to content

Commit

Permalink
chore(compiler): update cli to the latest develop version
Browse files Browse the repository at this point in the history
  • Loading branch information
davidyuk committed Jun 23, 2023
1 parent 7fb2759 commit 2215b22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
20 changes: 7 additions & 13 deletions test/integration/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,11 @@ function testCompiler(compiler: CompilerBase): void {
let inclSourceCode: string;
let inclFileSystem: Record<string, string>;
const inclBytecode = 'cb_+QEGRgOg7BH1sCv+p2IrS0Pn3/i6AfE8lOGUuC71lLPn6mbUm9PAuNm4cv4AWolkAjcCBwcHFBQAAgD+RNZEHwA3ADcAGg6CPwEDP/5Nt4A5AjcCBwcHDAECDAEABAMRAFqJZP6SiyA2ADcBBwcMAwgMAQAEAxFNt4A5/pSgnxIANwF3BwwBAAQDEarAwob+qsDChgI3AXcHPgQAALhgLwYRAFqJZD0uU3VibGlicmFyeS5zdW0RRNZEHxFpbml0EU23gDkxLkxpYnJhcnkuc3VtEZKLIDYRdGVzdBGUoJ8SJWdldExlbmd0aBGqwMKGOS5TdHJpbmcubGVuZ3Rogi8AhTcuMS4wAGHgFTw=';
// TODO: use Includes.aes after fixing https://github.com/aeternity/aesophia_cli/issues/74
const incSourceCodePath = './test/integration/contracts/Increment.aes';
let incSourceCode: string;
const incBytecode = 'cb_+G1GA6Cln3BxyOo1iNITGseMS58ZfBbRNB0x8Ix7Bh54qZlSOcC4QKD+Er1R0wA3AQcHFDQAAgD+RNZEHwA3ADcAGg6CPwEDP5svAhESvVHTJWluY3JlbWVudBFE1kQfEWluaXSCLwCFNy4wLjEAfImpuQ==';
const testBytecode = 'cb_+GhGA6BgYgXqYB9ctBcQ8mJ0+we5OXhb9PpsSQWP2DhPx9obn8C4O57+RNZEHwA3ADcAGg6CPwEDP/6AeCCSADcBd3cBAQCYLwIRRNZEHxFpbml0EYB4IJIZZ2V0QXJngi8AhTcuMC4xAMXqWXc=';

before(async () => {
inclSourceCode = await readFile(inclSourceCodePath, 'utf8');
inclFileSystem = await getFileSystem(inclSourceCodePath);
incSourceCode = await readFile(incSourceCodePath, 'utf8');
});

it('returns version', async () => {
Expand Down Expand Up @@ -60,20 +55,19 @@ function testCompiler(compiler: CompilerBase): void {
});

it('validates bytecode by path', async () => {
expect(await compiler.validate(incBytecode, incSourceCodePath))
.to.be.equal(true);
expect(await compiler.validate(testBytecode, incSourceCodePath)).to.be.equal(false);
expect(await compiler.validate(inclBytecode, inclSourceCodePath)).to.be.equal(true);
expect(await compiler.validate(testBytecode, inclSourceCodePath)).to.be.equal(false);
const invalidBytecode = `${testBytecode}test` as Encoded.ContractBytearray;
expect(await compiler.validate(invalidBytecode, incSourceCodePath))
.to.be.equal(false);
expect(await compiler.validate(invalidBytecode, inclSourceCodePath)).to.be.equal(false);
});

it('validates bytecode by source code', async () => {
expect(await compiler.validateBySourceCode(incBytecode, incSourceCode))
expect(await compiler.validateBySourceCode(inclBytecode, inclSourceCode, inclFileSystem))
.to.be.equal(true);
expect(await compiler.validateBySourceCode(testBytecode, incSourceCode)).to.be.equal(false);
expect(await compiler.validateBySourceCode(testBytecode, inclSourceCode, inclFileSystem))
.to.be.equal(false);
const invalidBytecode = `${testBytecode}test` as Encoded.ContractBytearray;
expect(await compiler.validateBySourceCode(invalidBytecode, incSourceCode))
expect(await compiler.validateBySourceCode(invalidBytecode, inclSourceCode, inclFileSystem))
.to.be.equal(false);
});
}
Expand Down
2 changes: 0 additions & 2 deletions test/integration/contracts/Increment.aes

This file was deleted.

4 changes: 2 additions & 2 deletions tooling/fetch-aesophia-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { dirname } from 'path';
import { writeFileSync, readFileSync, mkdirSync } from 'fs';

const path = './bin/aesophia_cli';
const hash = 'BqnxuwwjV5q+4nmnkB7Ksa6lR2wwFaCVT2Mq3Y5xJ6rgp5GiwQL3At0Sqi2Z573PXYw0JTXNsglA7R1SyuahVQ==';
const hash = '4iI/WntmiSTHryFmiFHnhwCPPA6JXXvB/T3Y1qVddUdcVIHlofzAcbClmxuSXLXSfM5+1omPJ2Vm1E8KBgCiiA==';

function ensureBinaryCorrect() {
const buffer = readFileSync(path);
Expand All @@ -16,7 +16,7 @@ try {
} catch {
console.log('Fetching aesophia_cli');
const request = await fetch(
'https://github.com/aeternity/aesophia_cli/releases/download/v7.1.0/aesophia_cli',
'https://github.com/aeternity/aesophia_cli/raw/1737f8112093b4ae2ce9e826188ecb6c9bb9c20a/aesophia_cli',
);
const body = Buffer.from(await request.arrayBuffer());
mkdirSync(dirname(path), { recursive: true });
Expand Down

0 comments on commit 2215b22

Please sign in to comment.