Skip to content

Commit

Permalink
Merge pull request #1 from trgarrett/externalize_agg_sig_me_additiona…
Browse files Browse the repository at this point in the history
…l_data

Add support for externalizing the AGG_SIG_ME_ADDITIONAL_DATA
  • Loading branch information
trgarrett authored Nov 3, 2023
2 parents 70adc83 + bfcda4d commit 8c4bbf5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
27 changes: 20 additions & 7 deletions fusion/fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@

P2_MOD: Program = load_clvm("p2_fusion.clsp", package_or_requirement="clsp", recompile=True)

AGG_SIG_ME_ADDITIONAL_DATA = DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA
PREFIX = os.environ.get("PREFIX", "xch")

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger()

MAX_BLOCK_COST_CLVM = DEFAULT_CONSTANTS.MAX_BLOCK_COST_CLVM

SINGLETON_AMOUNT = uint64(1)
FEE_TARGET_SIZE = int(os.environ.get('FEE_TARGET_SIZE', 1000))
COIN_TARGET_SIZE = SINGLETON_AMOUNT + FEE_TARGET_SIZE #1 singleton + 50000 fee
DERIVATIONS = int(os.environ.get('DERIVATIONS', 1000))
PREFIX = os.environ.get("PREFIX", "xch")

SINGLETON_INNER: Program = load_clvm("fusion_singleton.clsp", package_or_requirement="clsp", recompile=True)

Expand All @@ -80,15 +83,25 @@
full_node_rpc_port = config["full_node"]["rpc_port"] # 8555
wallet_rpc_port = config["wallet"]["rpc_port"] # 9256

agg_sig_config = None

TESTNET = os.environ.get("TESTNET", "testnet10")

if PREFIX == 'txch':
try:
agg_sig_config = bytes32.from_hexstr(config["farmer"]["network_overrides"]["constants"][TESTNET]["AGG_SIG_ME_ADDITIONAL_DATA"])
logger.info(f"Loaded AGG_SIG_ME_ADDITIONAL_DATA override: {agg_sig_config}")
except Exception as e:
logger.warning(f"Tried loading AGG_SIG_ME_ADDITIONAL_DATA from config. Exception {e}")

AGG_SIG_ME_ADDITIONAL_DATA = agg_sig_config or DEFAULT_CONSTANTS.AGG_SIG_ME_ADDITIONAL_DATA

wallet_keys = []
puzzle_reveals = {}

# track coins spent recently to make sure they are not re-selected during pending block confirmations
recent_coins: deque = deque([], 1000)

logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")
logger = logging.getLogger()


class Fusion:

Expand Down Expand Up @@ -567,8 +580,8 @@ async def make_swap_spend_bundle(self, singleton_launcher_id, singleton_inner_pu
SerializedProgram.from_program(full_solution)
)

spend_bundle = await sign_coin_spends([singleton_claim_coinsol], wallet_keyf,
self.get_synthetic_private_key_for_puzzle_hash,
spend_bundle = await sign_coin_spends([singleton_claim_coinsol], wallet_keyf,
self.get_synthetic_private_key_for_puzzle_hash,
AGG_SIG_ME_ADDITIONAL_DATA, MAX_BLOCK_COST_CLVM, [puzzle_hash_for_synthetic_public_key])
return spend_bundle

Expand Down
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ log_cli_level = INFO

env =
PREFIX=txch
TESTNET=simulator
FINGERPRINT=1307711849
CHIA_ROOT=~/.chia/simulator/main
1 change: 0 additions & 1 deletion tests/test_fusion.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
prefix = "txch"
logger = logging.getLogger()


##################################################################################################################
# NOTE: use one you have in your local simulator here!
FINGERPRINT = int(os.environ.get('FINGERPRINT'))
Expand Down

0 comments on commit 8c4bbf5

Please sign in to comment.