Skip to content

Commit

Permalink
Switch from superbased58 to fd58
Browse files Browse the repository at this point in the history
  • Loading branch information
riptl committed Apr 4, 2024
1 parent f44e23f commit 458b7fc
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 120 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,6 @@ dmypy.json
# Cython debug symbols
cython_debug/

# Cython generated
superbased58.c

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
Expand Down
1 change: 0 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ source test_suite_env/bin/activate
make -j -C impl
pip install .
protoc --python_out=src/test_suite invoke.proto
python setup.py build_ext --inplace
20 changes: 8 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ description = "Tests client targets against Solana"
authors = [
{ name = "Manik Jain", email = "mjain@jumptrading.com"}
]
dynamic = ['readme', 'version']
dynamic = ['version']
readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"base58~=2.1.0",
"loguru~=0.7.0",
"protobuf~=3.19.0",
"typer~=0.9.0",
"Cython>=3.0.9"
"fd58~=0.1.0",
"loguru~=0.7.0",
"protobuf~=3.19.0",
"typer~=0.9.0",
"Cython>=3.0.9"
]

[project.scripts]
Expand All @@ -32,10 +33,5 @@ dev = [
]

[build-system]
requires = ['setuptools', "wheel", "Cython", 'setuptools_scm[toml]']
requires = ['setuptools']
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
readme = {file = ["README.md"], content-type = "text/markdown"}

[tool.setuptools_scm]
16 changes: 0 additions & 16 deletions setup.py

This file was deleted.

30 changes: 11 additions & 19 deletions src/test_suite/codec_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import base64
import superbased58
import fd58
import test_suite.invoke_pb2 as pb


Expand All @@ -12,25 +12,21 @@ def decode_input(instruction_context: pb.InstrContext):
- instruction_context (pb.InstrContext): Instruction context (will be modified).
"""
if instruction_context.program_id:
instruction_context.program_id = superbased58.decode_32(
instruction_context.program_id
)
instruction_context.program_id = fd58.dec32(instruction_context.program_id)
if instruction_context.loader_id:
instruction_context.loader_id = superbased58.decode_32(
instruction_context.loader_id
)
instruction_context.loader_id = fd58.dec32(instruction_context.loader_id)

for i in range(len(instruction_context.accounts)):
if instruction_context.accounts[i].address:
instruction_context.accounts[i].address = superbased58.decode_32(
instruction_context.accounts[i].address = fd58.dec32(
instruction_context.accounts[i].address
)
if instruction_context.accounts[i].data:
instruction_context.accounts[i].data = base64.b64decode(
instruction_context.accounts[i].data
)
if instruction_context.accounts[i].owner:
instruction_context.accounts[i].owner = superbased58.decode_32(
instruction_context.accounts[i].owner = fd58.dec32(
instruction_context.accounts[i].owner
)

Expand All @@ -47,25 +43,21 @@ def encode_input(instruction_context: pb.InstrContext):
- instruction_context (pb.InstrContext): Instruction context (will be modified).
"""
if instruction_context.program_id:
instruction_context.program_id = superbased58.encode_32(
instruction_context.program_id
)
instruction_context.program_id = fd58.enc32(instruction_context.program_id)
if instruction_context.loader_id:
instruction_context.loader_id = superbased58.encode_32(
instruction_context.loader_id
)
instruction_context.loader_id = fd58.enc32(instruction_context.loader_id)

for i in range(len(instruction_context.accounts)):
if instruction_context.accounts[i].address:
instruction_context.accounts[i].address = superbased58.encode_32(
instruction_context.accounts[i].address = fd58.enc32(
instruction_context.accounts[i].address
)
if instruction_context.accounts[i].data:
instruction_context.accounts[i].data = base64.b64encode(
instruction_context.accounts[i].data
)
if instruction_context.accounts[i].owner:
instruction_context.accounts[i].owner = superbased58.encode_32(
instruction_context.accounts[i].owner = fd58.enc32(
instruction_context.accounts[i].owner
)

Expand All @@ -83,14 +75,14 @@ def encode_output(instruction_effects: pb.InstrEffects):
"""
for i in range(len(instruction_effects.modified_accounts)):
if instruction_effects.modified_accounts[i].address:
instruction_effects.modified_accounts[i].address = superbased58.encode_32(
instruction_effects.modified_accounts[i].address = fd58.enc32(
instruction_effects.modified_accounts[i].address
)
if instruction_effects.modified_accounts[i].data:
instruction_effects.modified_accounts[i].data = base64.b64encode(
instruction_effects.modified_accounts[i].data
)
if instruction_effects.modified_accounts[i].owner:
instruction_effects.modified_accounts[i].owner = superbased58.encode_32(
instruction_effects.modified_accounts[i].owner = fd58.enc32(
instruction_effects.modified_accounts[i].owner
)
6 changes: 0 additions & 6 deletions superbased58.pxd

This file was deleted.

32 changes: 0 additions & 32 deletions superbased58.pyx

This file was deleted.

31 changes: 0 additions & 31 deletions tests/test_solana_test_suite.py

This file was deleted.

0 comments on commit 458b7fc

Please sign in to comment.