Skip to content

Commit

Permalink
Bump Solana, Anchor and Ubuntu (hyperledger-solang#1389)
Browse files Browse the repository at this point in the history
Solana 1.16.1
Ubuntu 22.04 rather than 20.04
Anchor 0.28.0

Signed-off-by: Sean Young <sean@mess.org>
  • Loading branch information
seanyoung authored Jun 27, 2023
1 parent 46ec0e0 commit a1913b6
Show file tree
Hide file tree
Showing 21 changed files with 52 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
steps:
- name: Checkout sources
uses: actions/checkout@v3.1.0
Expand All @@ -33,7 +33,7 @@ jobs:
name: Linux arm64
runs-on: linux-arm64
if: ${{ github.repository_owner == 'hyperledger' }}
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
steps:
- name: Checkout sources
uses: actions/checkout@v3.1.0
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
lints:
name: Lints
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
linux-x86-64:
name: Linux x86-64
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand All @@ -86,14 +86,14 @@ jobs:
- uses: actions/upload-artifact@v3.1.0
with:
name: solang-linux-x86-64
path: ./target/debug/solang
path: ./target/debug/solang


linux-arm:
name: Linux Arm
runs-on: linux-arm64
if: ${{ github.repository_owner == 'hyperledger' }}
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
steps:
- name: Checkout sources
uses: actions/checkout@v3
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
anchor:
name: Anchor Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
needs: linux-x86-64
steps:
- name: Checkout sources
Expand Down Expand Up @@ -278,7 +278,7 @@ jobs:
solana:
name: Solana Integration test
runs-on: solang-ubuntu-latest
container: ghcr.io/hyperledger/solang-llvm:ci-3
container: ghcr.io/hyperledger/solang-llvm:ci-4
needs: linux-x86-64
steps:
- name: Checkout sources
Expand Down Expand Up @@ -372,7 +372,7 @@ jobs:
with:
toolchain: stable
default: true
override: true
override: true
- run: 'parallel solang compile -v --target substrate --release -o ./contracts/ ::: ../substrate/*.sol ../substrate/test/*.sol'
working-directory: ./integration/subxt-tests
- name: Deploy and test contracts
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/hyperledger/solang-llvm:ci-3 as builder
FROM ghcr.io/hyperledger/solang-llvm:ci-4 as builder

COPY . src
WORKDIR /src/stdlib/
Expand All @@ -9,7 +9,7 @@ RUN rustup default 1.68.0
WORKDIR /src
RUN cargo build --release

FROM ubuntu:20.04
FROM ubuntu:22.04
COPY --from=builder /src/target/release/solang /usr/bin/solang

LABEL org.opencontainers.image.title="Solang Solidity Compiler" \
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ Now you can deploy the contract code using:
solana program deploy flipper.so
```

Now install `@project-serum/anchor`:
Now install `@coral-xyz/anchor`:

```
npm install @project-serum/anchor
npm install @coral-xyz/anchor
```
Save the following to `flipper.js`:
```javascript
const { readFileSync } = require('fs');
const anchor = require('@project-serum/anchor');
const anchor = require('@coral-xyz/anchor');
const IDL = JSON.parse(readFileSync('./flipper.json', 'utf8'));
const PROGRAM_SO = readFileSync('./flipper.so');
Expand Down
4 changes: 2 additions & 2 deletions docs/targets/solana.rst
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ After deploying the program, you can start on the client side, which needs the a

.. code-block:: bash
npm install @project-serum/anchor
npm install @coral-xyz/anchor
Write the following javascript to a file called ``flipper.js``.

.. code-block:: javascript
const { readFileSync } = require('fs');
const anchor = require('@project-serum/anchor');
const anchor = require('@coral-xyz/anchor');
const IDL = JSON.parse(readFileSync('./flipper.json', 'utf8'));
const PROGRAM_SO = readFileSync('./flipper.so');
Expand Down
4 changes: 2 additions & 2 deletions integration/anchor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"build": "solang compile tests/*.sol --target solana -v -o tests/"
},
"dependencies": {
"@project-serum/anchor": "^0.26.0",
"@coral-xyz/anchor": "^0.28.0",
"ts-node": "^10.9.1",
"tsc-node": "^0.0.3"
},
Expand All @@ -21,4 +21,4 @@
"ts-mocha": "^10.0.0",
"typescript": "^4.3.5"
}
}
}
5 changes: 2 additions & 3 deletions integration/anchor/programs/anchor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ cpi = ["no-entrypoint"]
default = []

[dependencies]
anchor-lang = "0.27.0"
# solana-program 1.16.0 is broken, it depends on getrandom, which does not build for bpf
solana-program = "=1.14.18"
anchor-lang = "0.28.0"
solana-program = "1.16.1"
4 changes: 2 additions & 2 deletions integration/anchor/tests/anchor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-License-Identifier: Apache-2.0

import expect from 'expect';
import * as anchor from "@project-serum/anchor";
import { Program } from "@project-serum/anchor";
import * as anchor from "@coral-xyz/anchor";
import { Program } from "@coral-xyz/anchor";
import { Anchor } from "../target/types/anchor";

describe("Anchor", () => {
Expand Down
2 changes: 1 addition & 1 deletion integration/anchor/tests/call_anchor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import expect from 'expect';
import { AnchorProvider, Program } from '@project-serum/anchor';
import { AnchorProvider, Program } from '@coral-xyz/anchor';
import {
PublicKey, AccountMeta,
Keypair, Signer,
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/balances.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import expect from 'expect';
import { Transaction, SystemProgram, sendAndConfirmTransaction } from '@solana/web3.js';
import { loadContract } from './setup';
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';

describe('Deploy solang contract and test', function () {
this.timeout(500000);
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/calls.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import expect from 'expect';
import { loadContract, loadContractWithProvider } from './setup';
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';

describe('Testing calls', function () {
this.timeout(100000);
Expand Down
12 changes: 6 additions & 6 deletions integration/solana/create_contract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import { Connection, Keypair, PublicKey, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import expect from 'expect';
import { Program, Provider, BN } from '@project-serum/anchor';
import {create_account, loadContract} from './setup';
import { Program, Provider, BN } from '@coral-xyz/anchor';
import { create_account, loadContract } from './setup';
import fs from 'fs';

describe('ChildContract', function () {
Expand Down Expand Up @@ -147,14 +147,14 @@ describe('ChildContract', function () {

await create_account(child, child_program, 8192);
const signature = await program.methods.createWithoutAnnotation(child.publicKey)
.accounts( {dataAccount: storage.publicKey})
.accounts({ dataAccount: storage.publicKey })
.remainingAccounts(
[
{pubkey: child_program, isSigner: false, isWritable: false},
{pubkey: child.publicKey, isSigner: true, isWritable: true}
{ pubkey: child_program, isSigner: false, isWritable: false },
{ pubkey: child.publicKey, isSigner: true, isWritable: true }
]
).signers([child])
.rpc({ commitment: 'confirmed'});
.rpc({ commitment: 'confirmed' });

const tx = await provider.connection.getTransaction(signature, {
commitment: 'confirmed',
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: Apache-2.0

import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';
import expect from 'expect';
import { loadContract } from './setup';

Expand Down
2 changes: 1 addition & 1 deletion integration/solana/overflow.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import expect from 'expect';
import { loadContract } from './setup';
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';

describe('Testing math overflow', function () {
this.timeout(500000);
Expand Down
4 changes: 2 additions & 2 deletions integration/solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"typescript": "^4.1.2"
},
"dependencies": {
"@project-serum/anchor": "^0.26",
"@coral-xyz/anchor": "^0.28",
"@solana/spl-token": "0.2.0",
"@solana/web3.js": "^1.68",
"ethers": "^5.2.0",
Expand All @@ -26,4 +26,4 @@
"web3-eth-abi": "^1.3.0",
"web3-utils": "^1.3.0"
}
}
}
8 changes: 4 additions & 4 deletions integration/solana/runtime_errors.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: Apache-2.0

import {Keypair, PublicKey, sendAndConfirmTransaction, SystemProgram, Transaction} from '@solana/web3.js';
import { Keypair, PublicKey, sendAndConfirmTransaction, SystemProgram, Transaction } from '@solana/web3.js';
import expect from 'expect';
import {loadContract} from './setup';
import {Program, Provider, BN, AnchorProvider} from '@project-serum/anchor';
import {createAccount} from "@solana/spl-token";
import { loadContract } from './setup';
import { Program, Provider, BN, AnchorProvider } from '@coral-xyz/anchor';
import { createAccount } from "@solana/spl-token";

describe('Runtime Errors', function () {
this.timeout(150000);
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: Apache-2.0

import { Connection, Keypair, LAMPORTS_PER_SOL, PublicKey, BpfLoader, Transaction, SystemProgram, BPF_LOADER_PROGRAM_ID, TransactionExpiredBlockheightExceededError } from '@solana/web3.js';
import { AnchorProvider, Program } from '@project-serum/anchor';
import { AnchorProvider, Program } from '@coral-xyz/anchor';
import fs from 'fs';

const endpoint: string = process.env.RPC_URL || "http://127.0.0.1:8899";
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/simple.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import expect from 'expect';
import { loadContract } from './setup';
import crypto from 'crypto';
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';

describe('Simple solang tests', function () {
this.timeout(500000);
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/system_instruction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { loadContract } from "./setup";
import { Keypair, LAMPORTS_PER_SOL, PublicKey } from "@solana/web3.js";
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';


describe('Test system instructions', function () {
Expand Down
2 changes: 1 addition & 1 deletion integration/solana/token.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { getOrCreateAssociatedTokenAccount, createMint, TOKEN_PROGRAM_ID } from '@solana/spl-token';
import { Keypair } from '@solana/web3.js';
import { loadContract } from './setup';
import { BN } from '@project-serum/anchor';
import { BN } from '@coral-xyz/anchor';
import expect from 'expect';

describe('Create spl-token and use from solidity', function () {
Expand Down
14 changes: 9 additions & 5 deletions integration/solana/verify_sig.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Keypair, Ed25519Program, SYSVAR_INSTRUCTIONS_PUBKEY, PublicKey } from '
import expect from 'expect';
import nacl from 'tweetnacl';
import { loadContract } from './setup';
import { Program } from '@project-serum/anchor';
import { Program } from '@coral-xyz/anchor';

describe('Signature Check', function () {
this.timeout(150000);
Expand All @@ -30,8 +30,10 @@ describe('Signature Check', function () {

const result = await program.methods.verify(payer.publicKey, message, Buffer.from(signature))
.preInstructions([instr1])
.accounts({ dataAccount: storage.publicKey,
SysvarInstruction: SYSVAR_INSTRUCTIONS_PUBKEY})
.accounts({
dataAccount: storage.publicKey,
SysvarInstruction: SYSVAR_INSTRUCTIONS_PUBKEY
})
.view();

expect(result).toEqual(true);
Expand All @@ -54,8 +56,10 @@ describe('Signature Check', function () {

const result = await program.methods.verify(payer.publicKey, message, Buffer.from(broken_signature))
.preInstructions([instr1])
.accounts({ dataAccount: storage.publicKey,
SysvarInstruction: SYSVAR_INSTRUCTIONS_PUBKEY})
.accounts({
dataAccount: storage.publicKey,
SysvarInstruction: SYSVAR_INSTRUCTIONS_PUBKEY
})
.view();

expect(result).toEqual(false);
Expand Down

0 comments on commit a1913b6

Please sign in to comment.