1

Any help on this server error? I'm trying to fill in some gaps on a eosio python library, sending an assert sale action.

{'code': 500, 'message': 'Internal Service Error', 
'error': {'code': 3050003, 'name': 'eosio_assert_message_exception', 'what': 'eosio_assert_message assertion failure', 
'details': [{'message': 'assertion failure with message: failed to allocate pages', 'file': 'wasm_interface.cpp', 'line_number': 1131, 'method': 'eosio_assert'}, 
{'message': 'pending console output: ', 'file': 'apply_context.cpp', 'line_number': 113, 'method': 'exec_one'}]}} 

UPDATE: I've added the code. Like I mentioned at the top, I'm using the ueosio package that I've done tiny modifications in that it didn't have functions for packing lists of UI64s and symbols. I'm mostly looking to find methods of troubleshooting http error responses from the blockchain.

import sys
import os
import json
import binascii
import requests as r
from getpass import getpass
from datetime import datetime, timedelta
from ueosio import sign_tx, DataStream, get_expiration, get_tapos_info, build_push_transaction_body
from dotenv import load_dotenv, find_dotenv

load_dotenv(find_dotenv())
### example tx
tx = {"delay_sec":0,"max_cpu_usage_ms":0,"actions":[
    {"account":"atomicmarket","name":"assertsale","data":
        {"asset_ids_to_assert": [1099529376307], "listing_price_to_assert": ("0.50000000 WAX"), "sale_id": 11746616, "settlement_symbol_to_assert": "8,WAX"},"authorization":[
            {"actor":f"{fromAcct}","permission":"active"}]}]}


info = r.get('https://wax.greymass.com/v1/chain/get_info').json()
ref_block_num, ref_block_prefix = get_tapos_info(info['last_irreversible_block_id'])
chain_id = info['chain_id']

# package transaction
data = tx['actions'][0]['data']
ds = DataStream()
ds.pack_uint64List(data['asset_ids_to_assert'])
ds.pack_asset(data['listing_price_to_assert'])
ds.pack_uint64(data['sale_id'])
ds.pack_symbol(data['settlement_symbol_to_assert'])

tx['actions'][0]['data'] = binascii.hexlify(ds.getvalue()).decode('utf-8')

tx.update({
    "expiration": get_expiration(datetime.utcnow(), timedelta(minutes=15).total_seconds()),
    "ref_block_num": ref_block_num,
    "ref_block_prefix": ref_block_prefix,
    "max_net_usage_words": 0,
    "max_cpu_usage_ms": 0,
    "delay_sec": 0,
    "context_free_actions": [],
    "transaction_extensions": [],
    "context_free_data": []
})

# enter private key of the accounta
auth = tx['actions'][0]['authorization'][0]
private_key = os.environ.get("waxWalletPrivateKey")

# Sign transaction
tx_id, tx = sign_tx(
   chain_id,
   tx,
   private_key
)
ds = DataStream()
ds.pack_transaction(tx)
packed_trx = binascii.hexlify(ds.getvalue()).decode('utf-8')
tx = build_push_transaction_body(tx['signatures'][0], packed_trx)

# Push transaction
res = r.post('https://wax.greymass.com/v1/chain/push_transaction', json=tx).json()
print(res)
5
  • Could you add some details? E.g. library version, OS etc.
    – TeeAttack42
    May 6 at 7:50
  • I've updated the original post. Was away from my pc at the time I posted the message, so it was a messy cludge of Google Lens to recreate the error message. Running ueosio 0.2.5 on a Win10 box. Works fine on transfers but like I said, had to do some modifications to handle an assertsale action
    – Couch
    May 6 at 13:25
  • 1
    Post the source code for the action you're calling, there appears to be an issue, you can use the eosio::print function to print to trx console for cleos for debugging.
    – Nat
    May 12 at 12:53
  • As @Nat is saying, please provide more details.
    – ovi
    Jun 10 at 8:32
  • I second the print (cave man debugging style) usage for debugging. as for your endeavour to add support for "packing lists of UI64s and symbols" you could address this telegram channels, I am pretty sure you will get help there from them eosio experts: t.me/joinchat/0uhWYfXVpPlkNTA1
    – ovi
    Jun 25 at 7:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.