EOSIO/eosjs

Unknown action buyrambytes in contract eosio with v20

Closed this issue · 3 comments

Version of EOSJS
v20.0.0

Describe the bug
I'm unable to execute buyrambytes with v20. I have working examples with v16 and the same docker container, so I'm really not sure what's going on.

Error I receive is: "Unknown action buyrambytes in contract eosio" but I don't believe it's related to bootstrapping because:

  • I can run EOSJS v16 against the same docker container and successfully execute:
await this.eos.transaction(tr => {
        tr.newaccount({
            creator: this.accountsCreator.name,
            name: account.name,
            owner: account.publicKey,
            active: account.publicKey
        });

        tr.buyrambytes({
            payer: this.accountsCreator.name,
            receiver: account.name,
            bytes: 8192
        });

        tr.delegatebw({
            from: this.accountsCreator.name,
            receiver: account.name,
            stake_net_quantity: '10.0000 SYS',
            stake_cpu_quantity: '10.0000 SYS',
            transfer: 0
        });
    })
  • I can use cleos and create a new account just fine.

To Reproduce
Steps to reproduce the behavior:

  1. Use EOSJS with eos in this setup: https://github.com/EOSIO/eosio-project-boilerplate-simple
  2. Try to execute the following JS with the setup from the readme:
eos.transact(
{
	actions: [
		{
			account: 'eosio',
			name: 'newaccount',
			authorization: [
				{
					actor: creator.name,
					permission: 'active',
				},
			],
			data: {
				creator: creator.name,
				name: account.name,
				owner: {
					threshold: 1,
					keys: [
						{
							key: account.publicKey,
							weight: 1,
						},
					],
					accounts: [],
					waits: [],
				},
				active: {
					threshold: 1,
					keys: [
						{
							key: account.publicKey,
							weight: 1,
						},
					],
					accounts: [],
					waits: [],
				},
			},
		},
		{
			account: 'eosio',
			name: 'buyrambytes',
			authorization: [
				{
					actor: creator.name,
					permission: 'active',
				},
			],
			data: {
				payer: creator.name,
				receiver: account,
				bytes: 8192,
			},
		},
		{
			account: 'eosio',
			name: 'delegatebw',
			authorization: [
				{
					actor: creator.name,
					permission: 'active',
				},
			],
			data: {
				from: creator.name,
				receiver: account.name,
				stake_net_quantity: '10.0000 SYS',
				stake_cpu_quantity: '10.0000 SYS',
				transfer: false,
			},
		},
	],
},
{
	blocksBehind: 3,
	expireSeconds: 30,
}
);

Expected behavior
Expected success

Actual behaviour

Error: Unknown action buyrambytes in contract eosio
      at serializeActionData (/[project folder]/eosjs/src/eosjs-serialize.ts:1065:15)
      at Object.serializeAction ([project folder]/eosjs/src/eosjs-serialize.ts:1080:15)
      at Api.<anonymous> ([project folder]/eosjs/src/eosjs-api.ts:179:24)
      at step ([project folder]/eosjs/dist/eosjs-api.js:47:23)
      at Object.next ([project folder]/eosjs/dist/eosjs-api.js:28:53)
      at fulfilled ([project folder]/eosjs/dist/eosjs-api.js:19:58)
      at process._tickCallback (internal/process/next_tick.js:68:7)

Desktop (please complete the following information):

  • OS: Mac OS X 10.14.4
  • Browser: No browser involved
  • Runtime: Node v10.15.3

Context
Is there any good way to get nodeos to log out the transactions it receives exactly so I can see what the difference is between the two versions?

eosio-project-boilerplate-simple doesn't install the system contract. buyrambytes doesn't exist without it; all accounts have unlimited ram. eosjs 16 blindly assumed buyrambytes existed without checking; the result was a no-op.

Is there any good way to get nodeos to log out the transactions it receives exactly so I can see what the difference is between the two versions?

The closest is to use /v1/get_block. Decoding the action data will fail on the transaction generated by eosjs 16.

@thekevinbrown The project using eosjs v16 should not be "working" either, just failing silently. I'm going to close this, but I'll open an issue in the boilerplate to install the system contracts so no one else has issues with this.