optimised genesis mint population inside test hook

This commit is contained in:
Richard Holland
2023-06-05 13:21:49 +00:00
parent 1ae08afb02
commit 68b3db602b

View File

@@ -7,7 +7,7 @@
#define DEBUG 1
uint8_t txn_mint[13844] =
uint8_t txn_mint[13850] =
{
/* size,upto */
/* 3, 0 */ 0x12U, 0x00U, 0x60U, /* tt = GenesisMint */
@@ -36,8 +36,33 @@ uint8_t txn_mint[13844] =
F1 // tail byte
*
* */
// 210 bytes + 34 bytes per entry * number of entries + any alignment padding desired
};
uint8_t entry[40] = {
/* 0, 2 */ 0xE0U, 0x60U, // obj start
/* 2, 1 */ 0x61U, // amount header
/* 3, 8 */ 0,0,0,0,0,0,0,0, // amount payload
/* 11, 2 */ 0x83U, 0x14U, // account header
/* 13, 20 */ 0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0, // account payload
/* 33, 1 */ 0xE1U // obj end
};
#define ENTRY_DROPS(drops_tmp)\
{\
uint8_t* b = entry + 3U;\
*b++ = 0b01000000 + (( drops_tmp >> 56 ) & 0b00111111 );\
*b++ = (drops_tmp >> 48) & 0xFFU;\
*b++ = (drops_tmp >> 40) & 0xFFU;\
*b++ = (drops_tmp >> 32) & 0xFFU;\
*b++ = (drops_tmp >> 24) & 0xFFU;\
*b++ = (drops_tmp >> 16) & 0xFFU;\
*b++ = (drops_tmp >> 8) & 0xFFU;\
*b++ = (drops_tmp >> 0) & 0xFFU;\
}
#define BE_DROPS(drops)\
{\
uint64_t drops_tmp = drops;\
@@ -52,6 +77,8 @@ uint8_t txn_mint[13844] =
*b++ = (drops_tmp >> 0) & 0xFFU;\
}
//uint8_t preamble[4] = {0xE0U, 0x60U, 0x61U, 0x00};
int64_t hook(uint32_t r)
{
etxn_reserve(1);
@@ -59,24 +86,47 @@ int64_t hook(uint32_t r)
// emit the txn
uint64_t drops = 200;
BE_DROPS(drops);
uint64_t drops = 12345;
ENTRY_DROPS(drops);
#define COUNT 400
uint8_t* upto = txn_mint + 209U;
uint8_t* end = upto + (34U * COUNT);
*upto++ = 0xE0U; // obj start
*upto++ = 0x60U;
for (; GUARD(COUNT), upto < end; upto += 34)
{
uint64_t* d = (uint64_t*)upto;
uint64_t* s = (uint64_t*)entry;
*d++ = *s++;
*d++ = *s++;
//*d++ = *s++;
//*d++ = *s++;
*(d+2) = *(s+2);
otxn_field(upto + 13, 20, sfDestination);
*((uint32_t*)(upto + 13)) = upto;
*upto++ = 0x61U; // amt
*((uint64_t*)upto) = drops;
upto += 8;
/*
*
*upto++ = 0xE0U; // obj start
*upto++ = 0x60U;
*upto++ = 0x61U; // amt
*((uint32_t*)upto) = preamble;
upto += 3;
*upto++ = 0x83U; // acc
*upto++ = 0x14U;
otxn_field(upto, 20, sfDestination);
upto += 20;
*upto++ = 0xE1U; // obj end
*((uint64_t*)upto) = drops;
upto += 8;
*upto++ = 0x83U; // acc
*upto++ = 0x14U;
*((uint16_t*)upto) = preamble2;
upto += 2;
*/
}
*upto++ = 0xF1U; // array end
etxn_details(txn_mint + 91, 116);