Skip to content

Commit

Permalink
Ndev 3298 solana signatures (#447)
Browse files Browse the repository at this point in the history
* Implement scheduled transactions

---------

Co-authored-by: Evgeniy Zdanovich <[email protected]>
Co-authored-by: Andrey Falaleev <[email protected]>
  • Loading branch information
3 people authored Dec 8, 2024
1 parent 184bdb4 commit 4f7f31b
Show file tree
Hide file tree
Showing 32 changed files with 1,697 additions and 194 deletions.
32 changes: 31 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
from _pytest.config.argparsing import Parser
from _pytest.nodes import Item
from _pytest.runner import runtestprotocol
from solana.rpc.commitment import Confirmed
from solders.keypair import Keypair
from web3.middleware import geth_poa_middleware

from clickfile import TEST_GROUPS, EnvName
from utils.types import TestGroup
from utils.consts import LAMPORT_PER_SOL
from utils.neon_user import NeonUser
from utils.types import TestGroup, TreasuryPool
from utils.error_log import error_log
from utils import create_allure_environment_opts, setup_logging
from utils.faucet import Faucet
Expand Down Expand Up @@ -254,3 +257,30 @@ def faucet(pytestconfig: Config, web3_client_session) -> Faucet:
def accounts_session(pytestconfig: Config, web3_client_session, faucet, eth_bank_account):
accounts = EthAccounts(web3_client_session, faucet, eth_bank_account)
return accounts


@pytest.fixture(scope="function")
def neon_user(evm_loader, pytestconfig) -> NeonUser:
user = NeonUser()
evm_loader.request_airdrop(user.solana_account.pubkey(), 1000 * 10**9, commitment=Confirmed)
evm_loader.deposit_wrapped_sol_from_solana_to_neon(
user.solana_account, "0x" + user.neon_address.hex(), pytestconfig.environment.network_ids["sol"], int(1 * LAMPORT_PER_SOL)
)
return user


@pytest.fixture(scope="session")
def treasury_pool(evm_loader) -> TreasuryPool:
index = 2
address = evm_loader.create_treasury_pool_address(index)
index_buf = index.to_bytes(4, "little")
evm_loader.request_airdrop(address, 10000 * 10**9, commitment=Confirmed)
return TreasuryPool(index, address, index_buf)

@pytest.fixture(scope="session")
def treasury_pool_new(evm_loader) -> TreasuryPool:
index = 3
address = evm_loader.create_treasury_pool_address(index)
index_buf = index.to_bytes(4, "little")
evm_loader.request_airdrop(address, 10000 * 10**9, commitment=Confirmed)
return TreasuryPool(index, address, index_buf)
6 changes: 3 additions & 3 deletions contracts/neon_evm/transfers.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ contract transfers {
function donateTenPercent() public payable {
if (address(this).balance >= 1000) {
payable(msg.sender).transfer(address(this).balance / 10);

}

}

function donate1000() public payable {
payable(msg.sender).transfer(1000);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,6 @@
from utils.web3client import NeonChainWeb3Client


@pytest.fixture(scope="class")
def block_timestamp_contract(web3_client, accounts):
block_timestamp_contract, receipt = web3_client.deploy_and_get_contract(
"common/Block.sol", "0.8.10", accounts[0], contract_name="BlockTimestamp"
)
return block_timestamp_contract, receipt


@pytest.fixture(scope="class")
def block_number_contract(web3_client, accounts):
block_number_contract, receipt = web3_client.deploy_and_get_contract(
"common/Block.sol", "0.8.10", accounts[0], contract_name="BlockNumber"
)
return block_number_contract, receipt


@allure.feature("Opcodes verifications")
@allure.story("Verify block timestamp and block number")
@pytest.mark.usefixtures("accounts", "web3_client")
Expand Down
9 changes: 0 additions & 9 deletions integration/tests/basic/rpc/test_rpc_base_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@
]


def get_event_signatures(abi: tp.List[tp.Dict]) -> tp.List[str]:
"""Get topics as keccak256 from abi Events"""
topics = []
for event in filter(lambda item: item["type"] == "event", abi):
input_types = ",".join(i["type"] for i in event["inputs"])
signature = f"{event['name']}({input_types})"
topics.append(f"0x{keccak(signature.encode()).hex()}")
return topics


@allure.feature("JSON-RPC validation")
@allure.story("Verify JSON-RPC proxy calls work")
Expand Down
Loading

0 comments on commit 4f7f31b

Please sign in to comment.