skynetcap / solanaj

Solana RPC client written in Java
MIT License
83 stars 43 forks source link

Deprecated RPC call usage that will soon be removed #43

Closed Woody4618 closed 2 months ago

Woody4618 commented 2 months ago

Hey, there are bunch of RPC calls that are deprecated and will be removed very soon. You can find the deprecated calls here: https://github.com/anza-xyz/agave/wiki/Agave-v2.0-Transition-Guide

I searched your SDK for usage of these calls and looks like you are using

These calls will not be usable anymore soon after breakpoint when Agave 2.0 goes live.

You can find the all the usages in the code using this bash script: https://gist.githubusercontent.com/cloakd/2366d9c5d415c27a1f26f10de0b8be93/raw/d0d3a25dda23586ba9704f7985fb06093032ec72/check_words.sh

Here you can find a replacement implementation for rust and JS client side for get stake activation: https://github.com/solana-developers/solana-rpc-get-stake-activation

All other calls have replacement calls here: https://github.com/anza-xyz/agave/wiki/Agave-v2.0-Transition-Guide

If you know users of the SDK would also be great if you could inform them about the deprecated calls so nothing breaks when the calls actually get removed on mainnet.

Woody4618 commented 2 months ago

These are the locations of the calls:

/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:615:        ConfirmedBlock block = this.client.getApi().getConfirmedBlock(124398367);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:532:    public ConfirmedBlock getConfirmedBlock(int slot) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:538:        return client.call("getConfirmedBlock", params, ConfirmedBlock.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:648:        List<Double> blocks = this.client.getApi().getConfirmedBlocks(5);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:649:        List<Double> singleBlock = this.client.getApi().getConfirmedBlocks(5, 5);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:772:    public List<Double> getConfirmedBlocks(Integer start, Integer end) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:775:        return this.client.call("getConfirmedBlocks", params, List.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:782:    public List<Double> getConfirmedBlocks(Integer start) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:783:        return this.getConfirmedBlocks(start, null);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:160:    public List<SignatureInformation> getConfirmedSignaturesForAddress2(PublicKey account, int limit)
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:167:        List<AbstractMap> rawResult = client.call("getConfirmedSignaturesForAddress2", params, List.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:450:        String recentBlockHash = client.getApi().getRecentBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:513:        String recentBlockhash = client.getApi().getRecentBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:784:        String recentBlockHash = client.getApi().getRecentBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/programs/BPFLoaderTest.java:55:        String hash = client.getApi().getRecentBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:50:    public String getRecentBlockhash() throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:51:        return getRecentBlockhash(null);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:54:    public String getRecentBlockhash(Commitment commitment) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:61:        return client.call("getRecentBlockhash", params, RecentBlockhash.class).getValue().getBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:87:            recentBlockHash = getRecentBlockhash();
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:474:        FeesInfo feesInfo = client.getApi().getFees();
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:456:    public FeesInfo getFees() throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:457:        return getFees(null);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:460:    public FeesInfo getFees(Commitment commitment) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:467:        return client.call("getFees", params, FeesInfo.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:452:        FeeCalculatorInfo feeCalculatorInfo = client.getApi().getFeeCalculatorForBlockhash(recentBlockHash);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:422:    public FeeCalculatorInfo getFeeCalculatorForBlockhash(String blockhash) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:423:        return getFeeCalculatorForBlockhash(blockhash, null);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:426:    public FeeCalculatorInfo getFeeCalculatorForBlockhash(String blockhash, Commitment commitment) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:434:        return client.call("getFeeCalculatorForBlockhash", params, FeeCalculatorInfo.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:461:        FeeRateGovernorInfo feeRateGovernorInfo = client.getApi().getFeeRateGovernor();
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:462:        LOGGER.info(feeRateGovernorInfo.getValue().getFeeRateGovernor().toString());
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:465:        assertTrue(feeRateGovernorInfo.getValue().getFeeRateGovernor().getBurnPercent() > 0);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:466:        assertTrue(feeRateGovernorInfo.getValue().getFeeRateGovernor().getMaxLamportsPerSignature() > 0);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:467:        assertTrue(feeRateGovernorInfo.getValue().getFeeRateGovernor().getMinLamportsPerSignature() > 0);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:468:        assertTrue(feeRateGovernorInfo.getValue().getFeeRateGovernor().getTargetLamportsPerSignature() >= 0);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:469:        assertTrue(feeRateGovernorInfo.getValue().getFeeRateGovernor().getTargetSignaturesPerSlot() >= 0);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:437:    public FeeRateGovernorInfo getFeeRateGovernor() throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:438:        return client.call("getFeeRateGovernor", new ArrayList<>(), FeeRateGovernorInfo.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:329:        long snapshotSlot = client.getApi().getSnapshotSlot();
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:722:    public long getSnapshotSlot() throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:723:        return client.call("getSnapshotSlot", new ArrayList<>(), Long.class);
/Users/jonasmac2/Documents/GitHub/solanaj/src/test/java/org/p2p/solanaj/core/MainnetTest.java:521:        StakeActivation stakeActivation = client.getApi().getStakeActivation(
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:903:    public StakeActivation getStakeActivation(PublicKey publicKey) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:904:        return getStakeActivation(publicKey, null, null);
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:907:    public StakeActivation getStakeActivation(PublicKey publicKey, Long epoch, Commitment commitment) throws RpcException {
/Users/jonasmac2/Documents/GitHub/solanaj/src/main/java/org/p2p/solanaj/rpc/RpcApi.java:920:        return client.call("getStakeActivation", params, StakeActivation.class);
roway168 commented 2 months ago

Is it the same question?

org.p2p.solanaj.rpc.RpcException: Method not found at org.p2p.solanaj.rpc.RpcClient.call(RpcClient.java:101) at org.p2p.solanaj.rpc.RpcApi.getRecentBlockhash(RpcApi.java:61) at org.p2p.solanaj.rpc.RpcApi.getRecentBlockhash(RpcApi.java:51) at org.p2p.solanaj.rpc.RpcApi.sendTransaction(RpcApi.java:87) at org.p2p.solanaj.rpc.RpcApi.sendTransaction(RpcApi.java:115) at org.p2p.solanaj.rpc.RpcApi.sendTransaction(RpcApi.java:70) at org.p2p.solanaj.token.TokenManager.transferCheckedToSolAddress(TokenManager.java:95)

Woody4618 commented 2 months ago

Yes probably getRecentBlockhash is already removed on devnet.

roway168 commented 2 months ago

Yes probably getRecentBlockhash is already removed on devnet.

What is the relationship between Solanaj and Agave?

Woody4618 commented 2 months ago

Agave is a new company that is now maintaining the solana labs validator client and soon everyone will use agave solana 2.0. So all the rpc calls will also go to agave client.

roway168 commented 2 months ago

Agave is a new company that is now maintaining the solana labs validator client and soon everyone will use agave solana 2.0. So all the rpc calls will also go to agave client.

thanks,Is it just a substitution of some method names? https://www.helius.dev/blog/agave-2-0-transition

roway168 commented 2 months ago

@Woody4618 Is this method(getFeeForMessage) used to obtain transaction fees? Response = {"jsonrpc":"2.0","error":{"code":-32602,"message":"failed to deserialize solana_program::message::non_bpf_modules::versions::VersionedMessage: invalid value: integer 90, expected a valid transaction message version"},"id":"3d2c3636-a7db-4b1a-b660-9d79061ada50"}

https://cdn.prod.website-files.com/641ba798c17bb180d832b666/66cec83a1a96f4775c32312e_AD_4nXdxz0cIGoVEv-O8WlwJr2U8t-7jZPT0OseawvWW57Yg9cFI84CKw3Obnd4LzAoniyFHZHwroM9luvgFc7indGq3P1vWKbJJQxi8RQV8ZQZtwol_Og-u83L5nqipcuaP-DhttKHrzm6Kd6Ka4q6zDOuy9wYe.png

roway168 commented 2 months ago

@skynetcap Have all of these been fixed?

Woody4618 commented 2 months ago

Agave is a new company that is now maintaining the solana labs validator client and soon everyone will use agave solana 2.0. So all the rpc calls will also go to agave client.

thanks,Is it just a substitution of some method names? https://www.helius.dev/blog/agave-2-0-transition

These calls were deprecated for a while and will now be removed. On the guide you can see replacement calls for all the calls that will be removed soon. I created this issue because i saw there are a bunch of these used in the SDK. Most of them should be quite easy to replace with the new calls.

roway168 commented 2 months ago

Agave is a new company that is now maintaining the solana labs validator client and soon everyone will use agave solana 2.0. So all the rpc calls will also go to agave client.

thanks,Is it just a substitution of some method names? https://www.helius.dev/blog/agave-2-0-transition

These calls were deprecated for a while and will now be removed. On the guide you can see replacement calls for all the calls that will be removed soon. I created this issue because i saw there are a bunch of these used in the SDK. Most of them should be quite easy to replace with the new calls.

Thanks! getFeeCalculatorForBlockhash replacement getFeeForMessage. The following error occurred during operation: Response = {"jsonrpc":"2.0","error":{"code":-32602,"message":"failed to deserialize solana_program::message::non_bpf_modules::versions::VersionedMessage: invalid value: integer 90, expected a valid transaction message version"},"id":"3d2c3636-a7db-4b1a-b660-9d79061ada50"}

skynetcap commented 2 months ago

This has been fixed in 1.18.0. Thanks for filing the issue. Marked deprecated methods as such (They are still functional).

All new APIs have been added too.