hindley-milner-systems / dapp-ertp-airdrop

0 stars 2 forks source link

Ava-based stress tests which execute offers on a live blockchain #111

Closed tgrecojs closed 6 days ago

tgrecojs commented 1 month ago
tgrecojs commented 1 month ago

Planning

write ava test macro that facilitates communication of (a varying number of) offers to the tribblesAirdrop contract over the course of different, user-defined intervals.

tgrecojs commented 1 month ago

@dckc below are the contents of a test file i have in my local agoric-sdk.

I've added some comments within the code that I hope you find useful... and here are some additional points highlighting aspects of the code, how it's run.

// @ts-nocheck
import anyTest from '@endo/ses-ava/prepare-endo.js';
import type { TestFn } from 'ava';
import { makeDoOffer } from '../tools/e2e-tools.js';
import { commonSetup, SetupContextWithWallets } from './support.js';
import { addresses, defaultMerkleObject } from './airdrop-data/oct21-keys.js';
const test = anyTest as TestFn<SetupContextWithWallets>;

const contractName = 'tribblesAirdrop';
const contractBuilder =
  '../packages/builders/scripts/testing/start-tribbles-airdrop.js';
import SEED_PHRASES from './phrases.js';

const generateInt = x => () => Math.floor(Math.random() * (x + 1));

const createTestTier = generateInt(4); // ?

test.before(async t => {
  const {
    deleteTestKeys,
    startContract,
    // setupSpecificKeys should be used upon first pass of tests
    // adds keys to keyring, therefore it doesn't need to be called additional times (doing so will cause an error)
    setupSpecificKeys,
    vstorageClient,
    ...setup
  } = await commonSetup(t);

  // example usage. comment out after first run
  await setupSpecificKeys(SEED_PHRASES);

  await startContract(contractName, contractBuilder);

  const [brands] = await Promise.all([
    vstorageClient.queryData('published.agoricNames.brand'),
  ]);

  t.context = {
    ...setup,
    istBrand: Object.fromEntries(brands).IST,
    vstorageClient,
    deleteTestKeys,
  };
});

const defaultAcct = {
  pubkey: { key: '' },
  address: 'agoric12d3fault',
};

const makeOfferArgs = (account = defaultAcct) => ({
  key: account.pubkey.key,
  proof: defaultMerkleObject.getProof(account),
  address: account.address,
  tier: createTestTier(),
});

const makeDoOfferHandler = async (
  useChain,
  currentAccount,
  wallet,
  feeAmount,
) => {
  console.log(
    'claiming for account::',
    currentAccount.address,
    'pubkey',
    currentAccount.pubkey,
  );

  const doOffer = makeDoOffer(wallet);
  const startTime = performance.now();

  await doOffer({
    id: `offer-${Date.now()}`,
    invitationSpec: {
      source: 'agoricContract',
      instancePath: [contractName],
      callPipe: [['makeClaimTokensInvitation']],
    },
    offerArgs: makeOfferArgs(currentAccount),

    proposal: {
      give: {
        Fee: feeAmount,
      },
    },
  });

  const duration = performance.now() - startTime;
  return { ...currentAccount, duration, wallet };
};

const claimAirdropMacro = async (t, addressRange = [0, 1], delay) => {
  const [start, end] = addressRange;
  const { provisionSmartWallet, useChain, istBrand } = t.context;
  const durations = [];
  // Make multiple API calls with the specified delay
  for (let i = start; i < end; i++) {
    const currentAccount = defaultMerkleObject.getAccount(addresses[i]);
    console.log('Curren Acccount', currentAccount);
    console.log('Current iteration::', i);
    const wallet = await provisionSmartWallet(currentAccount.address, {
      IST: 1000n,
      BLD: 50n,
    });
    // picking off duration and address
    // this can be used to inspect the validity of offer results, however it comes at the expense
    // of a failing test halting execution & destroying duration data
    const { duration, address } = await makeDoOfferHandler(
      useChain,
      currentAccount,
      wallet,
      harden({ value: 5n, brand: istBrand }),
    );

    durations.push(duration);

    // Assert that the response matches the expected output

    console.group('######### CHECKING TRIBBLES ALLOCATION #######');
    console.log('----------------------------------');
    console.log('currentAccount.address ::::', address);
    console.log('----------------------------------');

    // Wait for the specified delay before making the next call
    await new Promise(resolve => setTimeout(resolve, delay));
  }
  return durations;
};

test.serial(
  'makeClaimTokensInvitation offers ### start: accounts[20] || end: accounts[24] ### offer interval: 10000ms',
  async t => {
    const claimRange = [20, 24];
    const durations = await claimAirdropMacro(t, claimRange, 10000);
    t.deepEqual(durations.length === 4, true);
    t.log('Durations for all calls', durations);
    console.group('################ START DURATIONS logger ##############');
    console.log('----------------------------------------');
    console.log('durations ::::', durations);
    console.log('----------------------------------------');
    console.log('claimRange ::::', claimRange);
    console.log('--------------- END DURATIONS logger -------------------');
    console.groupEnd();
  },
);

test.serial(
  'makeClaimTokensInvitation offers ### start: accounts[25] || end: accounts[29] ### offer interval: 5000ms',
  async t => {
    const claimRange = [25, 29];
    const durations = await claimAirdropMacro(t, claimRange, 5000);
    t.deepEqual(durations.length === 4, true);
    t.log('Durations for all calls', durations);
    console.group('################ START DURATIONS logger ##############');
    console.log('----------------------------------------');
    console.log('durations ::::', durations);
    console.log('----------------------------------------');
    console.log('claimRange ::::', claimRange);
    console.log('--------------- END DURATIONS logger -------------------');
    console.groupEnd();
  },
);
tgrecojs commented 1 month ago

commented updated per conversation with @dckc

Results from Tests

The first group of offers were executed 1 offer every 10000ms.

Times for offer to finish executing in milliseconds, ordered from 1st offer to last.

  1. 3598.9977499991655
  2. 3657.925792001188,
  3. 3517.243916999221,
  4. 5550.926750000566

The second group of offers were executed 1 offer every 5000ms.

Times for offer to finish executing in milliseconds, ordered from 1st offer to last.

  1. 3529.683791998774,
  2. 3511.035542000085,
  3. 5065.654874999876,
  4. 4486.1875
tgrecojs commented 4 weeks ago

@dckc updated to contain test results

dckc commented 4 weeks ago

Note a goal from internal discussion, added to

tgrecojs commented 1 week ago

Work Summary

I conducted performance testing of smart contract interactions on a local Agoric blockchain instance. The tests focused on measuring transaction latency under different request frequencies to assess the system's behavior under various loads.

Implementation Considerations

The Tribbles Airdrop architecture will utilize a Node.js server as an intermediary between the UI and RPC node. This design:

Methodology

Implementation Details

Test Scenarios and Results

Scenario 1

Scenario 2

Scenario 3

Key Findings

Next Steps

  1. Conduct stress testing against:
    • Agoric Xnet blockchain
    • Additional networks as specified by OpCo
  2. Implement rate limiting if required based on further testing results

Raw Data

details of start / end time, address, outcome, etc. ```javascript const scenario_one = [{ offerIndex: 1, account: { name: 'wallet-1731277116-16', type: 'local', address: 'agoric1gj4adjt653d6hnww0755wzarhnmdfsasp7ee0s', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A/6BuDnISiorZDL4k6GPAQ+O0+PAXi+HX9DCuJSX7vo3' }, mnemonic: 'effort industry change trim elbow staff science sunset black cause sunny sausage remind gauge mix pen vast author poet quick ride abstract veteran seat' }, startTime: 5951.096625000238, endTime: 11663.21329099685, latency: 5712.116665996611, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 2, account: { name: 'wallet-1731277116-17', type: 'local', address: 'agoric1v4l4z4pd4wxz74xg4ezffjgq3qlu7xz63s7j3p', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AwoqLWc/WzJCWYfQwbU1Y6flRf3A9EAr+zes6LoitA2Y' }, mnemonic: 'come slab hawk sing prison goddess sorry arm betray jewel heavy mule vague kitten habit daring slow ride lobster diesel clock venture rebuild asthma' }, startTime: 25279.60891599953, endTime: 33402.857332997024, latency: 8123.248416997492, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 3, account: { name: 'wallet-1731277116-18', type: 'local', address: 'agoric13mhm3a8w8lt7ptslwjjm806jmwq5n2yt45lkat', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4UNUqfBJSK0IpjSPbJ5CxbNY/R3oKL8cBRNdsEstR4e' }, mnemonic: 'video unfair sea aerobic spell element vague trial solar day drum army cricket warm enter sad cradle razor master rural allow debate satisfy gauge' }, startTime: 47790.56291599572, endTime: 51503.17429099977, latency: 3712.611375004053, isError: false, data: {}, message: 'Offer handled properly.' } , { offerIndex: 4, account: { name: 'wallet-1731277116-19', type: 'local', address: 'agoric1qlxazdvc79a9nxl8uhr88njrwp2psxx0s5dls0', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AhXLKwQB8v+FiR+Dy0dhBo0F9430CuLi8qwALU2Q7smC' }, mnemonic: 'buzz ramp window fit bronze forward dose discover inspire shadow segment lesson program best pitch snack scissors bid path fence moment patrol seven draft' }, startTime: 65884.91479099542, endTime: 69478.43937499821, latency: 3593.524584002793, isError: false, data: {}, message: 'Offer handled properly.' } , { offerIndex: 5, account: { name: 'wallet-1731277116-20', type: 'local', address: 'agoric1cww6mpazl8epxk029mc64f7pm66e885z6hn26s', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A973wY6QrKUEV/rc33x1mu7pWAfCYjwJGAKLFgWz1tZo' }, mnemonic: 'purity pond wing hotel prize material shield fee connect sphere wreck around size hedgehog remember crumble olive transfer insect useful sleep unknown detail garbage' }, startTime: 85904.91579099745, endTime: 90480.31458299607, latency: 4575.398791998625, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 6, account: { name: 'wallet-1731277116-21', type: 'local', address: 'agoric1g2d2nt5a9m4qg6t3ta3pqa6ftlnz6zvywhadrn', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A1xpDVrl2LUWbSJHDAtbGS4o247onKmFVV/K2xicrVpm' }, mnemonic: 'shed wedding problem trumpet walnut hungry east cargo almost humor never grief business egg nose idea rebel liberty smooth tired song half travel long' }, startTime: 106591.49699999392, endTime: 110239.69041599333, latency: 3648.1934159994125, isError: false, data: {}, message: 'Offer handled properly.' }, { startTime: 125163.57908299565, endTime: 129658.20920799673, latency: 4494.630125001073, isError: false }, { offerIndex: 8, account: { name: 'wallet-1731277116-23', type: 'local', address: 'agoric17qysg7zuue64kxjd484jc8n54n6mftanfq7ddz', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ai930POJ/WpOeU4iV6LAfbjDEHN1i+0AP5UGrVu+mU5x' }, mnemonic: 'cushion shop advice usage zoo across false average jar season antique portion cage senior like nurse march recipe early achieve visa evil multiply stem' }, startTime: 144266.30579099804, endTime: 151050.4420829937, latency: 6784.136291995645, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 9, account: { name: 'wallet-1731277116-24', type: 'local', address: 'agoric1zmajr36xrjdkl94pkattrhk5gs8859grqvru4m', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4vC6xjdZSGzUMGdKx6qnHALzZh80yUZ9hTTW2OpHLLT' }, mnemonic: 'shaft lift when canoe online hawk island divorce claw pistol average patient sail hurdle assault radio argue surround coin anxiety become glance measure matter' }, startTime: 164668.87504100055, endTime: 169565.23129099607, latency: 4896.35624999553, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 10, account: { name: 'wallet-1731277116-25', type: 'local', address: 'agoric1v3tg3nk8r4ndawqx9gfx808rda4d5dzx6jkw6j', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A6Pq2414VsYaJyQ+O4nIZcIjxd7yfrMT9m3M2ylxR0Zi' }, mnemonic: 'sample key settle bachelor pole ski bird idea town maximum refuse quiz grow twist danger exit demand remind phrase receive shine skin winner keen' }, startTime: 185616.97904099524, endTime: 191396.70595799387, latency: 5779.726916998625, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 11, account: { name: 'wallet-1731277116-26', type: 'local', address: 'agoric1s2dvk5xxnwz7un7uareh63cc3g6y8l7vnjr4d9', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AmwO+S7BHHNEehFnBGqsQlgF54LcN2fgm2LPImoVjAEK' }, mnemonic: 'forest earn wool rate metal eye seek wealth load chunk fence maid winter glow cup pull until smart kangaroo real forum trophy artist bench' }, startTime: 205183.67487499863, endTime: 209048.93766599894, latency: 3865.2627910003066, isError: false, data: {}, message: 'Offer handled properly.' } , { offerIndex: 12, account: { name: 'wallet-1731277116-27', type: 'local', address: 'agoric1t35nlveyzw2kjuall3h78c5t8qcsdlgu2qgj2j', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AwGRazLdf3C0jfSEjWTu3sSwW1cPsJRKpAHctRYv9QGq' }, mnemonic: 'possible icon liar liberty dentist turkey junk wreck aerobic task front submit suspect office apology open notice dress dance winter buzz myth wine seat' }, startTime: 224970.03837499768, endTime: 228588.8761659935, latency: 3618.8377909958363, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 13, account: { name: 'wallet-1731277116-28', type: 'local', address: 'agoric1q3f46v0mawgjp4vdc5q5g03xxcdh5a0r366z29', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4VYqNxelNd7h8xWlZu/IqgGv30hduRuhygCMYQpZyk+' }, mnemonic: 'club invest capital assist trumpet salt hair fun can frequent reunion rent sick bone grass near old resource park what broken quality coffee appear' }, startTime: 242781.4904159978, endTime: 246474.93429099768, latency: 3693.443874999881, isError: false, data: {}, message: 'Offer handled properly.' } , { offerIndex: 14, account: { name: 'wallet-1731277116-29', type: 'local', address: 'agoric1kq8t9szdreha96sz3459u0lwnlnzqae8n3jpav', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AtsvAASOMb2wcG1rODyFkEbE5fIOBGkxqJcXw9ltH7lm' }, mnemonic: 'fog draft kit liberty nest polar media ready feel aware illegal cherry insect palace brave sentence focus metal engage total usage virtual organ online' }, startTime: 260852.51524999738, endTime: 268665.61191599816, latency: 7813.096666000783, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 15, account: { name: 'wallet-1731277116-30', type: 'local', address: 'agoric1vxp5xrggfxudfjcaszggjjpwwsa9yhdmf2km54', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ai3MUBar+m8r6mOmtOl7uqWD5GNW2gDpLvl+WP+PBBfs' }, mnemonic: 'fantasy crowd uniform cause help rely exile enemy hammer region annual net uncle actress hair draft shoulder mosquito category limb remember tornado dog aware' }, startTime: 282574.7875829935, endTime: 286261.7889999971, latency: 3687.001417003572, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 16, account: { name: 'wallet-1731277116-31', type: 'local', address: 'agoric1plnchjvf9akf3v45qawxyv4muz39q3j3hyl5ay', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AkCXq3XqGUeiPpAAGHLCRjFcxOZIr25af8fx6OY6JRoX' }, mnemonic: 'mistake camp soul dirt symptom please alter pledge maid reopen olive alpha vivid famous add cup december place tourist wash stay solar business drill' }, startTime: 300199.59937499464, endTime: 303881.89820799977, latency: 3682.2988330051303, isError: false, data: {}, message: 'Offer handled properly.' } , { offerIndex: 17, account: { name: 'wallet-1731277116-32', type: 'local', address: 'agoric1grgeqgr7meupg32kwyvhugusuuearz4sfqcw24', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ag2mbQt26xaZOICLVAIrlDN6FxGIAQ1VmbElwErz7RFO' }, mnemonic: 'garden giraffe ancient three frog now luggage sustain shallow better banana more wish knife start embark hard swim toast empower verb maple access glad' }, startTime: 322374.72462499887, endTime: 326099.23483299464, latency: 3724.5102079957724, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 18, account: { name: 'wallet-1731277116-33', type: 'local', address: 'agoric1m889vtfv5u5d3qqf7jxer37nhjpfmspwwp5xf8', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AnkRxIKjl+W0oTMkwWjwO5SqOfoStODFtUEyKpxSBZjy' }, mnemonic: 'fuel armor cover muscle work globe glue motor error hub spoil humble wear into retreat truly reform copy friend order crystal valve rubber inquiry' }, startTime: 340882.2381249964, endTime: 344848.1579159945, latency: 3965.9197909981012, isError: false, data: {}, message: 'Offer handled properly.' }, { offerIndex: 19, account: { name: 'wallet-1731277116-34', type: 'local', address: 'agoric1cre0r0ca82jfkl4truacs533zt3s44lk95d5um', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'ArDOFdX1awQmdwa4xV3szreE++Li+a9RqakbYkYPE2Aq' }, mnemonic: 'pulse earn damp symbol minor diesel exit current first tennis onion report absent bench august category lady dismiss fit carbon one warfare lonely stuff' }, startTime: 364873.5498329997, endTime: 368868.0301249996, latency: 3994.4802919998765, isError: false, data: {}, message: 'Offer handled properly.' }]; const scenario_two = [ { account: { address: 'agoric15y9czct2jd0wtg8s443j006y6c6mjqqtqte5g4', mnemonic: 'feature learn seek disagree wife code area idea general drastic normal antenna mad hip coin cement wild near exact behave come make cluster reveal', name: 'wallet-1731277116-36', type: 'local', }, data: {}, endTime: 11051.589416995645, isError: false, latency: 3639.3325419947505, message: 'Offer handled properly.', offerIndex: 1, startTime: 7412.256875000894, }, { account: { address: 'agoric1kv7smunrm3f4h4kj7yakkjtdwph8njvrc56hhf', mnemonic: 'alcohol session zero velvet sun correct scatter glory vacant bag any final crew clarify holiday impulse nature update decorate fabric drip damage gospel expect', name: 'wallet-1731277116-37', type: 'local', }, data: {}, endTime: 44443.32041699439, isError: false, latency: 4543.671749994159, message: 'Offer handled properly.', offerIndex: 2, startTime: 39899.648667000234, }, { account: { address: 'agoric13t0ug0j7mm2j7a9ej76d9qxkue32373gfmpx4u', mnemonic: 'improve borrow life scout renew party kind endless float bridge sure august exercise kit present comic relax replace will blame print buffalo engine tube', name: 'wallet-1731277116-38', type: 'local', }, data: {}, endTime: 71483.81970799714, isError: false, latency: 3730.202500000596, message: 'Offer handled properly.', offerIndex: 3, startTime: 67753.61720799655, }, { account: { address: 'agoric1waejkeyppcvlqqzd6tknuqxx6v3xedsh3v8xx7', mnemonic: 'nominee luxury subject mirror holiday suit area scatter spy menu match over provide hamster anger wedding fury tip put medal symbol firm modify renew', name: 'wallet-1731277116-39', type: 'local', }, data: {}, endTime: 101520.71870800108, isError: false, latency: 5505.579083003104, message: 'Offer handled properly.', offerIndex: 4, startTime: 96015.13962499797, }, { account: { address: 'agoric16yawzl7umqheral694y844f8w83dwdpne3pgcw', mnemonic: 'wrist clay benefit secret camp lucky donor cruel lamp danger noble ostrich dose rude cup climb reflect axis drum awesome hard submit stay truck', name: 'wallet-1731277116-40', type: 'local', }, data: {}, endTime: 131302.99266699702, isError: false, latency: 5906.635917000473, message: 'Offer handled properly.', offerIndex: 5, startTime: 125396.35674999654, }, { account: { address: 'agoric1vtmukazn25jc02ck3tvxx8j3xw0vj4nln88pm6', mnemonic: 'wait lazy safe provide deal stone bread spatial banana vast burden draft wall enrich size puzzle peasant tree melody nation cargo vendor absent phrase', name: 'wallet-1731277116-41', type: 'local', }, data: {}, endTime: 161006.4686250016, isError: false, latency: 4887.81400000304, message: 'Offer handled properly.', offerIndex: 6, startTime: 156118.65462499857, }, { account: { address: 'agoric1unywh6rslqqeft3yr0kzkfuer89s6kvcus2mxn', mnemonic: 'spy young flash spot brush warm sheriff evil burst soft tell economy celery maze convince high leader squirrel during shield math anger initial head', name: 'wallet-1731277116-42', type: 'local', }, data: {}, endTime: 194317.22325000167, isError: false, latency: 9417.831208005548, message: 'Offer handled properly.', offerIndex: 7, startTime: 184899.39204199612, }, { account: { address: 'agoric1yz0x6ga6jkukv8u6sgqthdq4dgmx8jhj4z3n6k', mnemonic: 'matrix beauty cheese sand lounge enhance practice gym aisle clarify pig lava code yellow raw orient survey old roof oppose cave girl duty truck', name: 'wallet-1731277116-43', type: 'local', }, data: {}, endTime: 225730.64899999648, isError: false, latency: 6114.510207995772, message: 'Offer handled properly.', offerIndex: 8, startTime: 219616.1387920007, }, { account: { address: 'agoric19r8fwg238lt97h37qcz4r8kdqsfup35l5e59qw', mnemonic: 'pill canal sphere repair what focus post embody minor hill hundred announce devote maple smile absurd various fiscal scrap nurse goat pistol scrub very', name: 'wallet-1731277116-44', type: 'local', }, data: {}, endTime: 253504.36229199916, isError: false, latency: 3893.8984590023756, message: 'Offer handled properly.', offerIndex: 9, startTime: 249610.4638329968, }, { account: { address: 'agoric1txuldrseq4xj47fat5czcsnfy5mtx7ultwv9nd', mnemonic: 'flower pledge believe reduce speak jeans blossom ethics latin boring expect elite stove grow ski scheme badge aspect dad nose that pigeon embrace sniff', name: 'wallet-1731277116-45', type: 'local', }, data: {}, endTime: 284420.0261249989, isError: false, latency: 5810.495875000954, message: 'Offer handled properly.', offerIndex: 10, startTime: 278609.530249998, }, { account: { address: 'agoric1f0vhznds65ls3cr20kjp9xn3lvuc0c43ujqu38', mnemonic: 'zoo salute gospel swing theory brown decrease wage harsh couch smart volume light inch alone camera promote pause merge tortoise snow wheel cheap approve', name: 'wallet-1731277116-46', type: 'local', }, data: {}, endTime: 311760.6854169965, isError: false, latency: 3738.162833996117, message: 'Offer handled properly.', offerIndex: 11, startTime: 308022.52258300036, }, { account: { address: 'agoric13wm7ce9qhkgp345yuhfec4makg7nept2y93agy', mnemonic: 'fabric negative diet outer blood parent soul whale inmate fly lamp scare salon half cigar kit object uniform match into scan chronic reflect arena', name: 'wallet-1731277116-47', type: 'local', }, data: {}, endTime: 339644.5876249969, isError: false, latency: 3940.6302919983864, message: 'Offer handled properly.', offerIndex: 12, startTime: 335703.9573329985, }, { account: { address: 'agoric1hm6evatrekylxt5dlme0zvec2l2lay05uhzl65', mnemonic: 'soup distance notable mystery excess arrow tornado food nature age demand liar awake affair deal entry universe scout dial notable nice physical net derive', name: 'wallet-1731277116-48', type: 'local', }, data: {}, endTime: 369440.37508299947, isError: false, latency: 3812.017374999821, message: 'Offer handled properly.', offerIndex: 13, startTime: 365628.35770799965, }, { account: { address: 'agoric1j9c624lvftqlkynkz0g0458ckddvr6ch8a06hz', mnemonic: 'resist hello input once bulk wreck autumn such you calm crucial jazz planet kick taste little bag coil bring convince honey sense trouble rate', name: 'wallet-1731277116-49', type: 'local', }, data: {}, endTime: 399737.0397499949, isError: false, latency: 4542.225207999349, message: 'Offer handled properly.', offerIndex: 14, startTime: 395194.8145419955, }, { account: { address: 'agoric1knek3g43qldr9qtzhrj7j028nj2gpqjchdkyta', mnemonic: 'rifle grief peace slow science radar custom tail pudding lava machine leisure mask water globe assume hand celery index address work burst eyebrow bring', name: 'wallet-1731277116-50', type: 'local', }, data: {}, endTime: 428224.95837499946, isError: false, latency: 3715.1680830046535, message: 'Offer handled properly.', offerIndex: 15, startTime: 424509.7902919948, }, { account: { address: 'agoric1xe40lz352spr8wepew9yskr2ta7f4yr4uxnchn', mnemonic: 'convince will enrich bright assume bone attack rookie say universe art require try survey saddle path used night once upgrade noise air tape dutch', name: 'wallet-1731277116-51', type: 'local', }, data: {}, endTime: 455852.8448750004, isError: false, latency: 3801.914583005011, message: 'Offer handled properly.', offerIndex: 16, startTime: 452050.9302919954, }, { account: { address: 'agoric1xcxlf29w7cna9fmnt6l9k7zs2aqxej5vns8rsj', mnemonic: 'sail pool alcohol mouse narrow sausage invest inform oven battle rival perfect wheel monitor pumpkin december shallow skirt trouble slice room school novel cycle', name: 'wallet-1731277116-52', type: 'local', }, data: {}, endTime: 485965.7923329994, isError: false, latency: 6053.323208004236, message: 'Offer handled properly.', offerIndex: 17, startTime: 479912.4691249952, }, { account: { address: 'agoric18wuhds0pul2h60skx89nped7cpxryffxp5c0g7', mnemonic: 'plastic ship inner knee admit brief income wire horror spawn burden screen fringe athlete cabin goddess hard animal valve dice tomorrow still wash silent', name: 'wallet-1731277116-53', type: 'local', }, data: {}, endTime: 513544.096374996, isError: false, latency: 3747.009874999523, message: 'Offer handled properly.', offerIndex: 18, startTime: 509797.0864999965, }, { account: { address: 'agoric1jxc6dj6wn82plvxwvc45ke7pyg70emu6nh4u25', mnemonic: 'receive permit draft lecture crumble love obtain vivid family lens review worth replace barely rack bar now phrase lawn melt pelican fun school fantasy', name: 'wallet-1731277116-54', type: 'local', }, data: {}, endTime: 545806.9426250011, isError: false, latency: 5969.59570800513, message: 'Offer handled properly.', offerIndex: 19, startTime: 539837.346916996, }, { account: { address: 'agoric1hatrhhlt7z3nc36n95gfe9jujlh2dv364w8asq', mnemonic: 'giraffe exact judge enable security predict display steel manage lumber two science foot chapter food peanut unveil rather symbol pause unable impact demise swim', name: 'wallet-1731277116-55', type: 'local', }, data: {}, endTime: 577816.4335829988, isError: false, latency: 3806.5653750002384, message: 'Offer handled properly.', offerIndex: 20, startTime: 574009.8682079986, }, { account: { address: 'agoric1gv62yn35whmhceky7rxhv7gas2cg2n77vkckjw', mnemonic: 'divert art boss basic pitch human erode frown market drop movie tissue large random man erode grit proud wage loyal slice learn sleep advance', name: 'wallet-1731277116-56', type: 'local', }, data: {}, endTime: 607343.5927919969, isError: false, latency: 5748.403666995466, message: 'Offer handled properly.', offerIndex: 21, startTime: 601595.1891250014, }, { account: { address: 'agoric1w6c4yekudy0rzyr5xjf4hws8s26mpmptrn8slk', mnemonic: 'fancy measure dance soccer acquire soft water cover ritual bless series broken rose remain atom destroy cousin lens correct another neglect party mechanic entry', name: 'wallet-1731277116-57', type: 'local', }, data: {}, endTime: 636409.9497499987, isError: false, latency: 4559.591167002916, message: 'Offer handled properly.', offerIndex: 22, startTime: 631850.3585829958, }, { account: { address: 'agoric1kpzl42hac8psqh9eg9tgenvc8v4fw34v8mp6yy', mnemonic: 'stem fancy pretty surge plastic marriage measure chase ranch deliver boy deal rather consider humble vivid deposit bone spy pond rib black morning patch', name: 'wallet-1731277116-58', type: 'local', }, data: {}, endTime: 663956.3620419949, isError: false, latency: 3737.7159999981523, message: 'Offer handled properly.', offerIndex: 23, startTime: 660218.6460419968, }, { account: { address: 'agoric12pnwkq8n2mvymy8qvr9zn5g4tmjk062j0yln20', mnemonic: 'citizen drastic physical hungry unknown effort foam follow loud cram hollow across flight rich render salt enrich only message carbon bean behave neither pulp', name: 'wallet-1731277116-59', type: 'local', }, data: {}, endTime: 692814.3415419981, isError: false, latency: 4784.867083996534, message: 'Offer handled properly.', offerIndex: 24, startTime: 688029.4744580016, }, { account: { address: 'agoric1w8ptf03klpkhscrk486e8qj4ajrz9mgapr2z93', mnemonic: 'fragile race region eight noodle swarm boil caught coyote east deliver true aerobic cute radar confirm animal math essence broom together flavor month spider', name: 'wallet-1731277116-60', type: 'local', }, data: {}, endTime: 722915.261500001, isError: false, latency: 6210.8542920053005, message: 'Offer handled properly.', offerIndex: 25, startTime: 716704.4072079957, }, { account: { address: 'agoric1srjt3ujmqeehky39m4ng9a39h0t74dlcx58tsd', mnemonic: 'load antique era taxi buddy word elegant alley electric square lion input believe canal stage calm immune trouble dilemma thing lunar hockey bundle effort', name: 'wallet-1731277116-61', type: 'local', }, data: {}, endTime: 751510.7046669945, isError: false, latency: 4802.437833994627, message: 'Offer handled properly.', offerIndex: 26, startTime: 746708.2668329999, }, { account: { address: 'agoric1pnuwunt8gnptylzhx2y3x39scycglr6v3sjyrx', mnemonic: 'buyer spice alert during security pair leave dawn ice adult exist blanket tomato slam fruit icon main child pass effort argue depart hollow obscure', name: 'wallet-1731277116-62', type: 'local', }, data: {}, endTime: 780556.2896249965, isError: false, latency: 5349.812624998391, message: 'Offer handled properly.', offerIndex: 27, startTime: 775206.4769999981, }, { account: { address: 'agoric1wap8utnlnmw29am2h6j9hrm6u3h7ufdd6awf8z', mnemonic: 'roast riot coconut crouch jewel twist parent armed usual hour armor ivory shell network volcano float under extend above worry essay family ranch spatial', name: 'wallet-1731277116-63', type: 'local', }, data: {}, endTime: 808556.1800419986, isError: false, latency: 3861.995084002614, message: 'Offer handled properly.', offerIndex: 28, startTime: 804694.184957996, }, { account: { address: 'agoric1wv7sjjner9jj02ufqzejyas4fa5cdh3h04ck85', mnemonic: 'gold hawk slide neither session dial rely fence happy claim whip quiz orchard exercise seven increase fruit gather teach trigger glove model decrease pretty', name: 'wallet-1731277116-64', type: 'local', }, data: {}, endTime: 841241.4165420011, isError: false, latency: 6493.794334001839, message: 'Offer handled properly.', offerIndex: 29, startTime: 834747.6222079992, }, ]; const calculateAverageLatency = (data) => { const sum = data.reduce((acc, item) => acc + item.latency, 0); return sum / data.length; }; // Calculate median latency const calculateMedianLatency = (data) => { const sortedLatencies = data.map(item => item.latency).sort((a, b) => a - b); const mid = Math.floor(sortedLatencies.length / 2); return sortedLatencies.length % 2 === 0 ? (sortedLatencies[mid - 1] + sortedLatencies[mid]) / 2 : sortedLatencies[mid]; }; // Find min and max latencies const findLatencyExtremes = (data) => { return data.reduce((acc, item) => ({ min: Math.min(acc.min, item.latency), max: Math.max(acc.max, item.latency), minIndex: item.latency < acc.min ? item.offerIndex : acc.minIndex, maxIndex: item.latency > acc.max ? item.offerIndex : acc.maxIndex }), { min: Infinity, max: -Infinity, minIndex: null, maxIndex: null }); }; const scenario_three = [{ offerIndex: 1, account: { name: 'wallet-1731277116-16', type: 'local', address: 'agoric1gj4adjt653d6hnww0755wzarhnmdfsasp7ee0s', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A/6BuDnISiorZDL4k6GPAQ+O0+PAXi+HX9DCuJSX7vo3' }, mnemonic: 'effort industry change trim elbow staff science sunset black cause sunny sausage remind gauge mix pen vast author poet quick ride abstract veteran seat' }, startTime: 5951.096625000238, endTime: 11663.21329099685, latency: 5712.116665996611, isError: false, message: 'Offer handled properly.' },{ offerIndex: 2, account: { name: 'wallet-1731277116-17', type: 'local', address: 'agoric1v4l4z4pd4wxz74xg4ezffjgq3qlu7xz63s7j3p', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AwoqLWc/WzJCWYfQwbU1Y6flRf3A9EAr+zes6LoitA2Y' }, mnemonic: 'come slab hawk sing prison goddess sorry arm betray jewel heavy mule vague kitten habit daring slow ride lobster diesel clock venture rebuild asthma' }, startTime: 25279.60891599953, endTime: 33402.857332997024, latency: 8123.248416997492, isError: false, message: 'Offer handled properly.' } , { offerIndex: 3, account: { name: 'wallet-1731277116-18', type: 'local', address: 'agoric13mhm3a8w8lt7ptslwjjm806jmwq5n2yt45lkat', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4UNUqfBJSK0IpjSPbJ5CxbNY/R3oKL8cBRNdsEstR4e' }, mnemonic: 'video unfair sea aerobic spell element vague trial solar day drum army cricket warm enter sad cradle razor master rural allow debate satisfy gauge' }, startTime: 47790.56291599572, endTime: 51503.17429099977, latency: 3712.611375004053, isError: false, message: 'Offer handled properly.' }, { offerIndex: 4, account: { name: 'wallet-1731277116-19', type: 'local', address: 'agoric1qlxazdvc79a9nxl8uhr88njrwp2psxx0s5dls0', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AhXLKwQB8v+FiR+Dy0dhBo0F9430CuLi8qwALU2Q7smC' }, mnemonic: 'buzz ramp window fit bronze forward dose discover inspire shadow segment lesson program best pitch snack scissors bid path fence moment patrol seven draft' }, startTime: 65884.91479099542, endTime: 69478.43937499821, latency: 3593.524584002793, isError: false, message: 'Offer handled properly.' }, { offerIndex: 5, account: { name: 'wallet-1731277116-20', type: 'local', address: 'agoric1cww6mpazl8epxk029mc64f7pm66e885z6hn26s', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A973wY6QrKUEV/rc33x1mu7pWAfCYjwJGAKLFgWz1tZo' }, mnemonic: 'purity pond wing hotel prize material shield fee connect sphere wreck around size hedgehog remember crumble olive transfer insect useful sleep unknown detail garbage' }, startTime: 85904.91579099745, endTime: 90480.31458299607, latency: 4575.398791998625, isError: false, message: 'Offer handled properly.' }, { offerIndex: 6, account: { name: 'wallet-1731277116-21', type: 'local', address: 'agoric1g2d2nt5a9m4qg6t3ta3pqa6ftlnz6zvywhadrn', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A1xpDVrl2LUWbSJHDAtbGS4o247onKmFVV/K2xicrVpm' }, mnemonic: 'shed wedding problem trumpet walnut hungry east cargo almost humor never grief business egg nose idea rebel liberty smooth tired song half travel long' }, startTime: 106591.49699999392, endTime: 110239.69041599333, latency: 3648.1934159994125, isError: false, message: 'Offer handled properly.' }, { offerIndex: 7, account: { name: 'wallet-1731277116-22', type: 'local', address: 'agoric1djwjsjel7q58ufusu989q0784m46pd06v9e3aw', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AlH5crvUD1L8CVAeZyLIPsh3C6r0xuMUg/dgWweH4RQS' }, mnemonic: 'spin any man angry outer mammal opera toast cream catch cruise broken glance question power mechanic atom heart else tobacco motor blue quick fun' }, startTime: 125163.57908299565, endTime: 129658.20920799673, latency: 4494.630125001073, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 8, account: { name: 'wallet-1731277116-23', type: 'local', address: 'agoric17qysg7zuue64kxjd484jc8n54n6mftanfq7ddz', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ai930POJ/WpOeU4iV6LAfbjDEHN1i+0AP5UGrVu+mU5x' }, mnemonic: 'cushion shop advice usage zoo across false average jar season antique portion cage senior like nurse march recipe early achieve visa evil multiply stem' }, startTime: 144266.30579099804, endTime: 151050.4420829937, latency: 6784.136291995645, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 9, account: { name: 'wallet-1731277116-24', type: 'local', address: 'agoric1zmajr36xrjdkl94pkattrhk5gs8859grqvru4m', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4vC6xjdZSGzUMGdKx6qnHALzZh80yUZ9hTTW2OpHLLT' }, mnemonic: 'shaft lift when canoe online hawk island divorce claw pistol average patient sail hurdle assault radio argue surround coin anxiety become glance measure matter' }, startTime: 164668.87504100055, endTime: 169565.23129099607, latency: 4896.35624999553, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 10, account: { name: 'wallet-1731277116-25', type: 'local', address: 'agoric1v3tg3nk8r4ndawqx9gfx808rda4d5dzx6jkw6j', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A6Pq2414VsYaJyQ+O4nIZcIjxd7yfrMT9m3M2ylxR0Zi' }, mnemonic: 'sample key settle bachelor pole ski bird idea town maximum refuse quiz grow twist danger exit demand remind phrase receive shine skin winner keen' }, startTime: 185616.97904099524, endTime: 191396.70595799387, latency: 5779.726916998625, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 11, account: { name: 'wallet-1731277116-26', type: 'local', address: 'agoric1s2dvk5xxnwz7un7uareh63cc3g6y8l7vnjr4d9', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AmwO+S7BHHNEehFnBGqsQlgF54LcN2fgm2LPImoVjAEK' }, mnemonic: 'forest earn wool rate metal eye seek wealth load chunk fence maid winter glow cup pull until smart kangaroo real forum trophy artist bench' }, startTime: 205183.67487499863, endTime: 209048.93766599894, latency: 3865.2627910003066, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 12, account: { name: 'wallet-1731277116-27', type: 'local', address: 'agoric1t35nlveyzw2kjuall3h78c5t8qcsdlgu2qgj2j', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AwGRazLdf3C0jfSEjWTu3sSwW1cPsJRKpAHctRYv9QGq' }, mnemonic: 'possible icon liar liberty dentist turkey junk wreck aerobic task front submit suspect office apology open notice dress dance winter buzz myth wine seat' }, startTime: 224970.03837499768, endTime: 228588.8761659935, latency: 3618.8377909958363, isError: false, message: 'Offer handled properly.' }, { offerIndex: 13, account: { name: 'wallet-1731277116-28', type: 'local', address: 'agoric1q3f46v0mawgjp4vdc5q5g03xxcdh5a0r366z29', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'A4VYqNxelNd7h8xWlZu/IqgGv30hduRuhygCMYQpZyk+' }, mnemonic: 'club invest capital assist trumpet salt hair fun can frequent reunion rent sick bone grass near old resource park what broken quality coffee appear' }, startTime: 242781.4904159978, endTime: 246474.93429099768, latency: 3693.443874999881, isError: false, message: 'Offer handled properly.' },{ offerIndex: 14, account: { name: 'wallet-1731277116-29', type: 'local', address: 'agoric1kq8t9szdreha96sz3459u0lwnlnzqae8n3jpav', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AtsvAASOMb2wcG1rODyFkEbE5fIOBGkxqJcXw9ltH7lm' }, mnemonic: 'fog draft kit liberty nest polar media ready feel aware illegal cherry insect palace brave sentence focus metal engage total usage virtual organ online' }, startTime: 260852.51524999738, endTime: 268665.61191599816, latency: 7813.096666000783, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 15, account: { name: 'wallet-1731277116-30', type: 'local', address: 'agoric1vxp5xrggfxudfjcaszggjjpwwsa9yhdmf2km54', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ai3MUBar+m8r6mOmtOl7uqWD5GNW2gDpLvl+WP+PBBfs' }, mnemonic: 'fantasy crowd uniform cause help rely exile enemy hammer region annual net uncle actress hair draft shoulder mosquito category limb remember tornado dog aware' }, startTime: 282574.7875829935, endTime: 286261.7889999971, latency: 3687.001417003572, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 16, account: { name: 'wallet-1731277116-31', type: 'local', address: 'agoric1plnchjvf9akf3v45qawxyv4muz39q3j3hyl5ay', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AkCXq3XqGUeiPpAAGHLCRjFcxOZIr25af8fx6OY6JRoX' }, mnemonic: 'mistake camp soul dirt symptom please alter pledge maid reopen olive alpha vivid famous add cup december place tourist wash stay solar business drill' }, startTime: 300199.59937499464, endTime: 303881.89820799977, latency: 3682.2988330051303, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 17, account: { name: 'wallet-1731277116-32', type: 'local', address: 'agoric1grgeqgr7meupg32kwyvhugusuuearz4sfqcw24', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'Ag2mbQt26xaZOICLVAIrlDN6FxGIAQ1VmbElwErz7RFO' }, mnemonic: 'garden giraffe ancient three frog now luggage sustain shallow better banana more wish knife start embark hard swim toast empower verb maple access glad' }, startTime: 322374.72462499887, endTime: 326099.23483299464, latency: 3724.5102079957724, isError: false, message: 'Offer handled properly.' } ,{ offerIndex: 18, account: { name: 'wallet-1731277116-33', type: 'local', address: 'agoric1m889vtfv5u5d3qqf7jxer37nhjpfmspwwp5xf8', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'AnkRxIKjl+W0oTMkwWjwO5SqOfoStODFtUEyKpxSBZjy' }, mnemonic: 'fuel armor cover muscle work globe glue motor error hub spoil humble wear into retreat truly reform copy friend order crystal valve rubber inquiry' }, startTime: 340882.2381249964, endTime: 344848.1579159945, latency: 3965.9197909981012, isError: false, message: 'Offer handled properly.' },{ offerIndex: 19, account: { name: 'wallet-1731277116-34', type: 'local', address: 'agoric1cre0r0ca82jfkl4truacs533zt3s44lk95d5um', pubkey: { type: '/cosmos.crypto.secp256k1.PubKey', key: 'ArDOFdX1awQmdwa4xV3szreE++Li+a9RqakbYkYPE2Aq' }, mnemonic: 'pulse earn damp symbol minor diesel exit current first tennis onion report absent bench august category lady dismiss fit carbon one warfare lonely stuff' }, startTime: 364873.5498329997, endTime: 368868.0301249996, latency: 3994.4802919998765, isError: false, message: 'Offer handled properly.' }] const analysis = { scenario_one: { avg_latency: calculateAverageLatency(scenario_one),//, median: calculateMedianLatency(scenario_one), //? extremes: findLatencyExtremes(scenario_one) }, scenario_two: { avg_latency: calculateAverageLatency(scenario_two),//, median: calculateMedianLatency(scenario_two), //? extremes: findLatencyExtremes(scenario_two) }, scenario_three: { avg_latency: calculateAverageLatency(scenario_three),//, median: calculateMedianLatency(scenario_three), //? extremes: findLatencyExtremes(scenario_three) } } ```

cc @otoole-brendan

otoole-brendan commented 1 week ago

@tgrecojs Thanks for sharing above. We discussed usage/projections with Zaki in our sync the other week, it was roughly below:

I'm thinking we need to run scenario D and E above. Could you set that up? I'll run it by @dckc and Warner to get their take too

dckc commented 1 week ago

These look like pretty thorough performance testing results for the local chain case.

I suggest leaving xnet stuff out of scope of this issue, which lets you close this one.

Did you use release v0.0.1 8d9ca6e of the contract? If not, please keep the bundles around and, if you checked in the code, note the git hash.

If you checked in code (however scruffy) to do the testing above, please make a note of the git hash for future reference.

tgrecojs commented 6 days ago

got it @dckc thanks!

Did you use release v0.0.1 https://github.com/hindley-milner-systems/dapp-ertp-airdrop/commit/8d9ca6ec090efbd4ecbfeebe3baa7e695efd3642 of the contract? If not, please keep the bundles around and, if you checked in the code, note the git hash.

I did use this version of the contract for release v0.1.0

I'm about to push up a fix for #121.

Update

The latest release is v0.1.1. One thing to note is that the merkle root is likely different as it was computed using a different set of accounts.

dckc commented 4 days ago

I tried making plots of the raw data. Data points for scenario 1 and 3 are identical. Copy-and-paste problem somewhere? Can you clarify?

tgrecojs commented 4 days ago

@dckc I'm just seeing this now.

thanks for pointing this out as I was operating under the belief that they had produced the same results when inspecting the final measurements. I even mentioned this to @otoole-brendan on slack 😮

my words were something along the lines of "look how insanely consistent these numbers are!" 🤦‍♂️ I'll get to this first this in the morning.