Open kupermind opened 11 months ago
Notes:
anchor build
solang compile solidity/nft_token.sol -v --target solana
3f6c3ea21cf0a31d72064b8775ecefab nft_token.so
3f6c3ea21cf0a31d72064b8775ecefab target/deploy/nft_token.so
solang compile solidity/nft_token.sol -O none -v --target solana
cp nft_token.so target/deploy/
./validator.sh (in separate windows)
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && anchor test --skip-build --skip-local-validator
Deploying program "nft_token"...
Program path: /home/andrey/valory/autonolas-tokenomics-solana/target/deploy/nft_token.so...
Error: ELF error: ELF error: Found writable section (.bss) in ELF, read-write data not supported
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.
solang compile solidity/nft_token.sol -O less -v --target solana
cp nft_token.so target/deploy/
./validator.sh (in separate windows)
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && anchor test --skip-build --skip-local-validator
Deploying program "nft_token"...
Program path: /home/andrey/valory/autonolas-tokenomics-solana/target/deploy/nft_token.so...
Error: ELF error: ELF error: Found writable section (.bss) in ELF, read-write data not supported
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.
solang compile solidity/nft_token.sol -O default -v --target solana
cp nft_token.so target/deploy/nft_token.so
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && anchor test --skip-build --skip-local-validator
Deploying program "nft_token"...
Program path: /home/andrey/valory/autonolas-tokenomics-solana/target/deploy/nft_token.so...
Program Id: GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb
Deploy success
Found a 'test' script in the Anchor.toml. Running it as a test suite!
Running test suite: "/home/andrey/valory/autonolas-tokenomics-solana/Anchor.toml"
yarn run v1.22.19
warning ../../package.json: No license field
$ /home/andrey/valory/autonolas-tokenomics-solana/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000 'tests/**/*.ts'
Provider wallet: 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h
nft_token
User wallet: 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h
price: 68.469738
lower & upper tick_index: -443632 443632
lower & upper price: 0.000000 18438674135049479094762.080954
..
'Program GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb failed: Access violation in unknown section at address 0xa of size 32'
],
programErrorStack: ProgramErrorStack {
stack: [
[PublicKey [PublicKey(GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb)]]
]
}
}
solang compile solidity/nft_token.sol -O aggressive -v --target solana
cp nft_token.so target/deploy/nft_token.so
solana airdrop 10000 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h --url localhost && anchor test --skip-build --skip-local-validator
Deploying program "nft_token"...
Program path: /home/andrey/valory/autonolas-tokenomics-solana/target/deploy/nft_token.so...
Program Id: GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb
Deploy success
Found a 'test' script in the Anchor.toml. Running it as a test suite!
Running test suite: "/home/andrey/valory/autonolas-tokenomics-solana/Anchor.toml"
yarn run v1.22.19
warning ../../package.json: No license field
$ /home/andrey/valory/autonolas-tokenomics-solana/node_modules/.bin/ts-mocha -p ./tsconfig.json -t 1000000 'tests/**/*.ts'
Provider wallet: 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h
nft_token
User wallet: 9fit3w7t6FHATDaZWotpWqN7NpqgL3Lm1hqUop4hAy8h
price: 68.469738
lower & upper tick_index: -443632 443632
lower & upper price: 0.000000 18438674135049479094762.080954
..
'Program GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb failed: Access violation in unknown section at address 0xa of size 32'
],
programErrorStack: ProgramErrorStack {
stack: [
[PublicKey [PublicKey(GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb)]]
]
}
}
Describe the bug We are unable to correctly finalize the call to the Orca whirlpool program fork after we have obtained the whirlpool interface via the
solang idl whirlpool.json
command.When doing the CPI, we have tried to analyze how the whirlpool SDK calls the needed function, and the assembled data seem to match with what we have passed into the function.
In brief, the CPI we are calling is this one: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/a1676ba93a7da2f0da44d32647752b76ac8ae1ae/solidity/nft_token.sol#L207-L224
The
solana idl
-obtained whirlpool interface is located here: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/integration/solidity/interfaces/whirlpool.solThe originating script code is located here: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/a1676ba93a7da2f0da44d32647752b76ac8ae1ae/tests/nft_token.ts#L328-L362
To Reproduce Steps to reproduce the behavior:
'Program GUGGHzwC8wEKY3g7QS38YmoS8t5Q2faWAGAfxDK2bXbb failed: Access violation in unknown section at address 0xa of size 32'
errorPlease read the main README in order to reproduce the exact behavior: https://github.com/valory-xyz/autonolas-tokenomics-solana/tree/integration
In order to see the expected behavior, the following lines can be uncommented: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/a1676ba93a7da2f0da44d32647752b76ac8ae1ae/tests/nft_token.ts#L227-L260
When calling the decreaseLiquidity() function via the whirlpool SDK, we are seeing the following data formed:
We can then state that the decreaseLiquidity() selector is correctly created by the
solang idl whirlpool.json
execution as it matches here: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/a1676ba93a7da2f0da44d32647752b76ac8ae1ae/solidity/interfaces/whirlpool.sol#L192-L193We have also tried to just encode the data into the set of bytes to follow the SDK output, and those lines are listed here: https://github.com/valory-xyz/autonolas-tokenomics-solana/blob/a1676ba93a7da2f0da44d32647752b76ac8ae1ae/solidity/nft_token.sol#L221-L223
However, we've got the same error result.
Expected behavior We expected the decreaseLiquidity() function to complete and essentially decrease the liquidity of our LP token.
Screenshots Seeing behavior
Expected behavior:
Hyperledger Solang version Version of Solang (v0.3.3) Version of Solana (solana-cli 1.17.7 (src:fca44b78; feat:3073089885, client:SolanaLabs)) Version of Anchor (anchor-cli 0.29.0)
Include the complete solidity source code The code is located here: https://github.com/valory-xyz/autonolas-tokenomics-solana/tree/integration
Additional context Add any other context about the problem here.