Compare commits

...

7 Commits

Author SHA1 Message Date
dfy313 c58cf69e9d
Merge d6715a8327 into c96846fce2 2024-04-24 02:52:36 +05:00
czkz c96846fce2
ts: Fix incorrect `maxSupportedTransactionVersion` in `AnchorProvider.send*()` methods (#2922) 2024-04-23 18:39:18 +02:00
acheron 10c997552e
Add `anchor-derive-serde` crate to the publish script (#2924) 2024-04-23 00:48:58 +02:00
David Yu d6715a8327
Address PR Feedback
This commit renames the compatibility-testing package, test file, and test case to: solana-program-test-compatibility, compatibility-test.rs, and check_entrypoint. This commit also updates the compatibility test by passing None to the builtin_function argument, and letting cargo test-sbf load the programs. Finally, this commit updates the CI job in reusable-tests to take advantage of existing structure.
2024-03-19 11:16:20 -04:00
dfy313 4f8b32d9ad
Merge branch 'coral-xyz:master' into dfy313-anchor2738-solana-program-test-compatability 2024-03-19 10:44:04 -04:00
David Yu 6ac4d9e86d
Add test-anchor-compatibility job to CI
This CI job executes the newly added solana_program_test entrypoint_lifetime test. “continue-on-error: true” is included as the compatibility test is currently expected to fail
2024-03-14 12:28:59 -04:00
David Yu a2c404decd
Initial commit: add compatibility-testing package to tests directory
The compatibility-testing package contains a simple compatibility test defined in compatibility-testing/programs/compatibility-testing/tests/solana_program_test.rs that checks for entrypoint lifetime compatibility
2024-03-14 12:03:49 -04:00
15 changed files with 141 additions and 1 deletions

View File

@ -460,6 +460,8 @@ jobs:
path: tests/bench
- cmd: cd tests/idl && ./test.sh
path: tests/idl
- cmd: cd tests/solana-program-test-compatibility && cargo test-sbf --package solana-program-test-compatibility --test compatibility_test check_entrypoint
path: tests/idl
# TODO: Enable when `solang` becomes compatible with the new IDL spec
# - cmd: cd tests/solang && anchor test
# path: tests/solang

View File

@ -16,7 +16,8 @@ The minor version will be incremented upon a breaking change and the patch versi
### Fixes
- syn: Eliminate variable allocations that build up stack space for token extension code generation ([#2913](https://github.com/coral-xyz/anchor/pull/2913)).
- lang: Eliminate variable allocations that build up stack space for token extension code generation ([#2913](https://github.com/coral-xyz/anchor/pull/2913)).
- ts: Fix incorrect `maxSupportedTransactionVersion` in `AnchorProvider.send*()` methods ([#2922](https://github.com/coral-xyz/anchor/pull/2922)).
### Breaking

View File

@ -15,6 +15,8 @@ publish:
sleep 25
cd lang/derive/accounts/ && cargo publish && cd ../../../
sleep 25
cd lang/derive/serde/ && cargo publish && cd ../../../
sleep 25
cd lang/derive/space/ && cargo publish && cd ../../../
sleep 25
cd lang/attribute/access-control/ && cargo publish && cd ../../../

View File

@ -38,6 +38,7 @@
"spl/token-proxy",
"spl/token-wrapper",
"spl/transfer-hook",
"solana-program-test-compatibility",
"swap",
"system-accounts",
"sysvars",

View File

@ -0,0 +1,8 @@
.anchor
.DS_Store
target
node_modules
dist
build
test-ledger

View File

@ -0,0 +1,18 @@
[toolchain]
[features]
seeds = false
skip-lint = false
[programs.localnet]
solana_program_test_compatibility = "3cgdzWdfZSy1GaV6Lg98iwLvTcL9W7AVD8BpxiZjCZ9z"
[registry]
url = "https://api.apr.dev"
[provider]
cluster = "Localnet"
wallet = "/Users/david/.config/solana/id.json"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

View File

@ -0,0 +1,13 @@
[workspace]
members = [
"programs/*"
]
[profile.release]
overflow-checks = true
lto = "fat"
codegen-units = 1
[profile.release.build-override]
opt-level = 3
incremental = false
codegen-units = 1

View File

@ -0,0 +1,12 @@
// Migrations are an early feature. Currently, they're nothing more than this
// single deploy script that's invoked from the CLI, injecting a provider
// configured from the workspace's Anchor.toml.
const anchor = require("@coral-xyz/anchor");
module.exports = async function (provider) {
// Configure client to use the provider.
anchor.setProvider(provider);
// Add your deploy script here.
};

View File

@ -0,0 +1,19 @@
{
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@coral-xyz/anchor": "^0.29.0"
},
"devDependencies": {
"chai": "^4.3.4",
"mocha": "^9.0.3",
"ts-mocha": "^10.0.0",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"typescript": "^4.3.5",
"prettier": "^2.6.2"
}
}

View File

@ -0,0 +1,22 @@
[package]
name = "solana-program-test-compatibility"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "solana_program_test_compatibility"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = { path = "../../../../lang" }
[dev-dependencies]
solana-program-test = ">=1.16, <1.18"

View File

@ -0,0 +1,2 @@
[target.bpfel-unknown-unknown.dependencies.std]
features = []

View File

@ -0,0 +1,15 @@
use anchor_lang::prelude::*;
declare_id!("3cgdzWdfZSy1GaV6Lg98iwLvTcL9W7AVD8BpxiZjCZ9z");
#[program]
pub mod solana_program_test_compatibility {
use super::*;
pub fn initialize(_ctx: Context<Initialize>) -> Result<()> {
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize {}

View File

@ -0,0 +1,10 @@
use solana_program_test::ProgramTest;
#[test]
fn check_entrypoint() {
let _pt = ProgramTest::new(
"solana_program_test_compatibility",
solana_program_test_compatibility::id(),
None,
);
}

View File

@ -0,0 +1,11 @@
{
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
}

View File

@ -174,8 +174,10 @@ export class AnchorProvider implements Provider {
? tx.signatures?.[0] || new Uint8Array()
: tx.signature ?? new Uint8Array()
);
const maxVer = isVersionedTransaction(tx) ? 0 : undefined;
const failedTx = await this.connection.getTransaction(txSig, {
commitment: "confirmed",
maxSupportedTransactionVersion: maxVer,
});
if (!failedTx) {
throw err;
@ -256,8 +258,10 @@ export class AnchorProvider implements Provider {
? tx.signatures?.[0] || new Uint8Array()
: tx.signature ?? new Uint8Array()
);
const maxVer = isVersionedTransaction(tx) ? 0 : undefined;
const failedTx = await this.connection.getTransaction(txSig, {
commitment: "confirmed",
maxSupportedTransactionVersion: maxVer,
});
if (!failedTx) {
throw err;